Skip to content

GLSL fragment shader that makes a moving checkered pattern from two given colors

License

Notifications You must be signed in to change notification settings

aypie/checkered-shader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Check-check!

This is a GLSL fragment shader that takes two vec3 colors and makes a moving checkered pattern using them. You can also define MovX, MovY and the CheckSize.

How it works

Basically all we do is draw regular stripes horizontally and vertically. We substract horizontal stripes from vertical stripes, and the absolute of the result will be a checkered pattern, we then can use this pattern to mix our given colors and output the final color.

Just this, however, only works for the static pattern and only for integer values of CheckSize. As we need a moving pattern without jittering - we need to add smooth edges to the stripes, and we do that using the Stripe() function that draws stripes considering the smoothness of the edges. To do that Stripe() draws pixel-wide linear falloffs on the edges of the stripes.

About

GLSL fragment shader that makes a moving checkered pattern from two given colors

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages