Синтаксис:
Используется glsl
/// Портировано с http://www.iquilezles.org/apps/shadertoy/
Shader "Tunnel" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_TimeT ("Time", Float) = 0.5
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
#pragma target 3.0
#include "UnityCG.cginc"
sampler2D _MainTex;
float _TimeT;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half2 resolution = half2(1.0,1.0);
half2 p = -1.0 + 2.0 * IN.uv_MainTex.xy / resolution.xy;
half2 uv;
float a = atan2(p.y,p.x);
float r = sqrt(dot(p,p));
uv.x = .75*_TimeT+.1/r;
uv.y = a/3.1416;
half3 col = tex2D(_MainTex,uv).xyz;
half4 color = half4(col*r,1.0);
o.Albedo = color.rgb;
o.Alpha = color.a;
}
ENDCG
}
FallBack "Diffuse"
}
Shader "Tunnel" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_TimeT ("Time", Float) = 0.5
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
#pragma target 3.0
#include "UnityCG.cginc"
sampler2D _MainTex;
float _TimeT;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half2 resolution = half2(1.0,1.0);
half2 p = -1.0 + 2.0 * IN.uv_MainTex.xy / resolution.xy;
half2 uv;
float a = atan2(p.y,p.x);
float r = sqrt(dot(p,p));
uv.x = .75*_TimeT+.1/r;
uv.y = a/3.1416;
half3 col = tex2D(_MainTex,uv).xyz;
half4 color = half4(col*r,1.0);
o.Albedo = color.rgb;
o.Alpha = color.a;
}
ENDCG
}
FallBack "Diffuse"
}