Shader "Unlit/Test"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Cx("Cx",Range(-0.8,0.375))=-0.8
_Cy("Cy",Range(-1,1))=0.15
_scale("scale",Range(1,3))=1.6
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Cx;
float _Cy;
float _scale;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float _Ax=_scale*(0.5-i.uv.x)/0.5;
float _Ay=_scale*(0.5-i.uv.y)/0.5;
float juliaValue;
for(int ind=0;ind<200;ind++)
{
float Ax=_Ax*_Ax-_Ay*_Ay;
float Ay=_Ay*_Ax+_Ax*_Ay;
_Ax=Ax+_Cx;
_Ay=Ay+_Cy;
juliaValue=sqrt(_Ax*_Ax+_Ay*_Ay);
if(juliaValue>100)
{
return fixed4(0,0,0,1);
}
}
return fixed4(juliaValue,(fixed)(sin(_Time*100)+1)/2,(fixed)(cos(_Time*50)+1)/2,1);
}
ENDCG
}
}
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Cx("Cx",Range(-0.8,0.375))=-0.8
_Cy("Cy",Range(-1,1))=0.15
_scale("scale",Range(1,3))=1.6
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Cx;
float _Cy;
float _scale;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float _Ax=_scale*(0.5-i.uv.x)/0.5;
float _Ay=_scale*(0.5-i.uv.y)/0.5;
float juliaValue;
for(int ind=0;ind<200;ind++)
{
float Ax=_Ax*_Ax-_Ay*_Ay;
float Ay=_Ay*_Ax+_Ax*_Ay;
_Ax=Ax+_Cx;
_Ay=Ay+_Cy;
juliaValue=sqrt(_Ax*_Ax+_Ay*_Ay);
if(juliaValue>100)
{
return fixed4(0,0,0,1);
}
}
return fixed4(juliaValue,(fixed)(sin(_Time*100)+1)/2,(fixed)(cos(_Time*50)+1)/2,1);
}
ENDCG
}
}
}