//Copyright (c) 2021 sunasaji //Copyright (c) 2019 yukatayu-vrc https://github.com/yukatayu-vrc/HUD_shader/blob/master/LICENSE //This code is licensed under the MIT License. Shader "Unlit/LKGCamera45" { Properties { _MainTex("Texture00", 2D) = "white" {} _Tex01 ("Texture01", 2D) = "white" {} _Tex02 ("Texture02", 2D) = "white" {} _Tex03 ("Texture03", 2D) = "white" {} _Tex04 ("Texture04", 2D) = "white" {} _Tex05 ("Texture05", 2D) = "white" {} _Tex06 ("Texture06", 2D) = "white" {} _Tex07 ("Texture07", 2D) = "white" {} _Tex08 ("Texture08", 2D) = "white" {} _Tex09 ("Texture09", 2D) = "white" {} _Tex10 ("Texture10", 2D) = "white" {} _Tex11 ("Texture11", 2D) = "white" {} _Tex12 ("Texture12", 2D) = "white" {} _Tex13 ("Texture13", 2D) = "white" {} _Tex14 ("Texture14", 2D) = "white" {} _Tex15 ("Texture15", 2D) = "white" {} _Tex16 ("Texture16", 2D) = "white" {} _Tex17 ("Texture17", 2D) = "white" {} _Tex18 ("Texture18", 2D) = "white" {} _Tex19 ("Texture19", 2D) = "white" {} _Tex20 ("Texture20", 2D) = "white" {} _Tex21 ("Texture21", 2D) = "white" {} _Tex22 ("Texture22", 2D) = "white" {} _Tex23 ("Texture23", 2D) = "white" {} _Tex24 ("Texture24", 2D) = "white" {} _Tex25 ("Texture25", 2D) = "white" {} _Tex26 ("Texture26", 2D) = "white" {} _Tex27 ("Texture27", 2D) = "white" {} _Tex28 ("Texture28", 2D) = "white" {} _Tex29 ("Texture29", 2D) = "white" {} _Tex30 ("Texture30", 2D) = "white" {} _Tex31 ("Texture31", 2D) = "white" {} _Tex32 ("Texture32", 2D) = "white" {} _Tex33 ("Texture33", 2D) = "white" {} _Tex34 ("Texture34", 2D) = "white" {} _Tex35 ("Texture35", 2D) = "white" {} _Tex36 ("Texture36", 2D) = "white" {} _Tex37 ("Texture37", 2D) = "white" {} _Tex38 ("Texture38", 2D) = "white" {} _Tex39 ("Texture39", 2D) = "white" {} _Tex40 ("Texture40", 2D) = "white" {} _Tex41 ("Texture41", 2D) = "white" {} _Tex42 ("Texture42", 2D) = "white" {} _Tex43 ("Texture43", 2D) = "white" {} _Tex44 ("Texture44", 2D) = "white" {} _SwitchTex ("Switch", 2D) = "white" {} _TileX("Tile X number", int) = 5 _TileY("Tile Y number", int) = 9 _TargetScreenX("Target Screen X Resolution", int) = 1920 _TargetScreenY("Target Screen Y Resolution", int) = 1080 } SubShader { Tags { "RenderType"="Transparent" "Queue"="Overlay+4000" "IgnoreProjector"="True" } ZTest Always // 常に前面に表示 Cull Off // 裏面が見えている場合も処理する Pass { // Meta CGPROGRAM #pragma target 3.0 #include "UnityCG.cginc" // Struct struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; UNITY_FOG_COORDS(1) float4 vertex : SV_POSITION; }; // Param UNITY_DECLARE_TEX2D(_MainTex); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex01); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex02); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex03); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex04); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex05); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex06); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex07); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex08); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex09); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex10); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex11); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex12); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex13); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex14); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex15); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex16); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex17); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex18); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex19); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex20); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex21); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex22); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex23); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex24); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex25); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex26); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex27); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex28); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex29); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex30); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex31); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex32); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex33); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex34); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex35); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex36); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex37); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex38); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex39); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex40); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex41); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex42); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex43); UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex44); sampler2D _SwitchTex; float2 maxScreenRatio; int _TileX, _TileY, _TargetScreenX, _TargetScreenY; float _PosX, _PosY, _Shift; // Vertex #pragma vertex vert v2f vert (appdata v) { v2f o; // Shift Quilt Area to the Center _Shift = 1.0 - (1.0 * min(_TargetScreenX, _TargetScreenY) / max (_TargetScreenX, _TargetScreenY)); if(_TargetScreenX > _TargetScreenY){ _PosX = _Shift; }else{ _PosY = _Shift; } // Hide vertex to other players half4 showBoolTex = tex2Dlod(_SwitchTex, float4(0, 0, 0, 0)); bool showFlag = showBoolTex.r != 0; // Hide vertex if screen ratio is different from _TargetScreenX / _TargetScreenY if(0.01