Closed satoshikanno closed 3 years ago
Shader "ShaderMan/MyShader"
{
Properties{
_MainTex("MainTex",2D) = "white"{}
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
Pass
{
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float4 vec4(float x,float y,float z,float w){return float4(x,y,z,w);}
float4 vec4(float x){return float4(x,x,x,x);}
float4 vec4(float2 x,float2 y){return float4(float2(x.x,x.y),float2(y.x,y.y));}
float4 vec4(float3 x,float y){return float4(float3(x.x,x.y,x.z),y);}
float3 vec3(float x,float y,float z){return float3(x,y,z);}
float3 vec3(float x){return float3(x,x,x);}
float3 vec3(float2 x,float y){return float3(float2(x.x,x.y),y);}
float2 vec2(float x,float y){return float2(x,y);}
float2 vec2(float x){return float2(x,x);}
float vec(float x){return float(x);}
struct VertexInput {
float4 vertex : POSITION;
float2 uv:TEXCOORD0;
float4 tangent : TANGENT;
float3 normal : NORMAL;
//VertexInput
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv:TEXCOORD0;
//VertexOutput
};
sampler2D _MainTex;
VertexOutput vert (VertexInput v)
{
VertexOutput o;
o.pos = UnityObjectToClipPos (v.vertex);
o.uv = v.uv;
//VertexFactory
return o;
}
fixed4 frag(VertexOutput vertex_output) : SV_Target
{
float2 U = vertex_output.uv;
float2 R = 1; U = (U+U-R)/R.y;
U = vec2(atan2(U.x,U.y)*3./3.1416,log(length(U))); // conformal polar
// multiply U for smaller tiles
U.y += U.x/6.; // comment for concentric circles instead of spiral
float4 O = tex2D(_MainTex, frac(-U+_Time.w));
return O;
}
ENDCG
}
}
}
I have tried to compile https://www.shadertoy.com/view/MddSRB#, but it does not work. I tried it on the web, but it failed. In Unity, I'm getting the error Shader error in 'ShaderMan/MyShader': undeclared identifier 'U' at line 70 (on metal).
} }