Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/Debug Grid" {
- Properties
- {
- _Color("Color", Color) = (1,1,1,1)
- [NoScaleOffset]_MainTex("Main texture", 2D) = "white" {}
- _Repeatance("Repeatance",float) = 1.0
- }
- SubShader {
- Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
- CGPROGRAM
- #pragma surface surf Standard vertex:vert
- #pragma target 3.0
- sampler2D _MainTex;
- struct vertexInput {
- float4 vertex : POSITION;
- float3 normal : NORMAL;
- float4 tangent : TANGENT;
- };
- struct Input {
- float3 worldPos;
- float4 vert;
- float3 normal;
- };
- half _Repeatance;
- fixed4 _Color;
- void vert (inout vertexInput v, out Input o) {
- o.worldPos= mul(unity_ObjectToWorld,v.vertex).xyz;
- o.vert = v.vertex;
- o.normal = v.normal;
- }
- void surf (Input IN, inout SurfaceOutputStandard o) {
- float2 uv = (IN.worldPos.xz * IN.normal.y + IN.worldPos.xy * IN.normal.z + IN.worldPos.yz * IN.normal.x) * _Repeatance;
- fixed4 c = tex2D (_MainTex, uv) * _Color;
- o.Albedo = c.rgb;
- o.Alpha = _Color.a;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement