Skip to content

Instantly share code, notes, and snippets.

@youz
Last active February 19, 2021 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youz/9828212d68f3c7552f8d9708060d6510 to your computer and use it in GitHub Desktop.
Save youz/9828212d68f3c7552f8d9708060d6510 to your computer and use it in GitHub Desktop.
ゲーミングWindowsTerminal
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings {
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
float3 hsv2rgb(float3 hsv)
{
// ref. https://gist.github.com/iUltimateLP/5129149bf82757b31542
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(hsv.xxx + K.xyz) * 6.0 - K.www);
return hsv.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), hsv.y);
}
float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
{
float4 color = shaderTexture.Sample(samplerState, tex);
float t = Time * 16;
float2 b = step(1.0, (tex * Resolution + t) % 20);
color.xyz += hsv2rgb(float3(Time + (tex.x + tex.y) / 4, 1.0, 0.6)) * step(b.x + b.y, 1.0);
return color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment