Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/ScreenOffset"
- {
- Properties
- {
- _MainTex ("Albedo (RGB)", 2D) = "white" {}
- _ScreenNo ("ScreenNo", Int) = 0
- }
- SubShader
- {
- Tags { "RenderType"="Opaque" }
- LOD 200
- CGPROGRAM
- // Physically based Standard lighting model, and enable shadows on all light types
- #pragma surface surf Standard fullforwardshadows
- // Use shader model 3.0 target, to get nicer looking lighting
- #pragma target 3.0
- sampler2D _MainTex;
- struct Input
- {
- float2 uv_MainTex;
- };
- half _Glossiness;
- half _Metallic;
- int _ScreenNo;
- // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
- // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
- // #pragma instancing_options assumeuniformscaling
- UNITY_INSTANCING_BUFFER_START(Props)
- // put more per-instance properties here
- UNITY_INSTANCING_BUFFER_END(Props)
- void surf (Input IN, inout SurfaceOutputStandard o)
- {
- float u = IN.uv_MainTex.x;
- float su = (fmod(_ScreenNo, 3.0) + u) / 3.0;
- float v = IN.uv_MainTex.y;
- float sv = (floor(_ScreenNo / 3.0) + v) / 2.0;
- fixed4 c = tex2D(_MainTex, float2(su, sv));
- o.Albedo = c.rgb;
- o.Emission = c.rgb;
- o.Metallic = 0;
- o.Smoothness = 0;
- o.Alpha = 1;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Add Comment
Please, Sign In to add comment