Skip to content

Instantly share code, notes, and snippets.

@aike
Created October 5, 2018 18:26
Show Gist options
  • Save aike/21faaeb5c254032619bf71cdb57563f3 to your computer and use it in GitHub Desktop.
Save aike/21faaeb5c254032619bf71cdb57563f3 to your computer and use it in GitHub Desktop.
Chiba City Skybox for Unity
Shader "Skybox/ChibaCity"
{
CGINCLUDE
struct appdata
{
float4 vertex : POSITION;
float3 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
float3 texcoord : TEXCOORD0;
};
float random(fixed2 p) {
return frac(sin(dot(p, fixed2(12.9898,78.233))) * 43758.5453);
}
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = fixed4(1, 1, 1, 1);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
float c = random(i.vertex.xy * _SinTime) * pow(i.vertex.y * 0.001, 3.0);
return fixed4(c * 0.9,c * 0.8, c, 1.0);
}
ENDCG
SubShader
{
Tags{ "RenderType" = "Background" "Queue" = "Background" "PreviewType" = "SkyBox" }
LOD 200
Pass
{
ZWrite Off
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment