Skip to content

Instantly share code, notes, and snippets.

@w0wca7a
Last active December 16, 2024 19:47
Show Gist options
  • Save w0wca7a/183b73a821cdbb5b218e05af27b6fa7e to your computer and use it in GitHub Desktop.
Save w0wca7a/183b73a821cdbb5b218e05af27b6fa7e to your computer and use it in GitHub Desktop.
shader Training1 : ComputeColor, Texturing
{
override float4 Compute()
{
//float r,g,b;
float r = 0.2f;
float g = 0.2f;
float b = 0.57f;
float time = (Global.Time) * 4.0f;
float ot1 = 5.0f;
float ot3 = 2.0f;
float ot5 = 0.1f;
float ot7 = 0.01f;
float ot9 = 0.025f;
float Q = 5000.0f;
float2 uv = streams.TexCoord.xy;
float amnt;
float nd;
float ip;
float alpha;
float4 cbuff = 0.0f;
for(float i = 0.0; i < 10.0; i++)
{
ip = i - 2.0f;
nd = 1.0f/4.0f * ot1 * sin(uv.x * 2.0f * 3.14f + ip * 0.4f + time * 0.05f)/2.0f;
nd += 1.0f/4.0f * ot3 * sin(3.0f * uv.x * 2.0f * 3.14f + ip * 0.4f)/2.0f;
nd += 1.0f/4.0f * ot5 * sin(5.0f * uv.x * 2.0f * 3.14f + ip * 0.4f)/2.0f;
nd += 1.0f/4.0f * ot7 * sin(7.0f * uv.x * 2.0f * 3.14f + ip * 0.4f)/2.0f;
nd /= 5.0f;
nd += 0.5f;
amnt = 1.0f/abs(nd - uv.y) * 0.01f;
amnt = smoothstep(0.01f, 0.5f + 10.0f * uv.y, amnt) * 5.5f;
alpha = (10.0f - i)/5.0f;
cbuff += float4(amnt * alpha * 0.3f, amnt * 0.3f * alpha, amnt * uv.y * alpha, 0.0f) ;
}
return float4(cbuff.x * r, cbuff.y * g, cbuff.z * b ,1.0f);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment