Skip to content

Instantly share code, notes, and snippets.

@rileyjshaw
Last active November 6, 2025 13:30
Show Gist options
  • Save rileyjshaw/4288ea4c39cc9039c060f884363d2cef to your computer and use it in GitHub Desktop.
Save rileyjshaw/4288ea4c39cc9039c060f884363d2cef to your computer and use it in GitHub Desktop.
Predator (1987) camo sketch for ShaderBooth (https://shaderbooth.com/)
// by rileyjshaw
// inspired by the camo effect in predator (1987)
void main() {
vec3 color = getCam(uv);
vec2 dir = uv - faceCenter;
float lenDir = length(dir);
if (lenDir < 1e-5) {
dir = vec2(0.0, 1.0); // avoid divide-by-zero at exact center
} else {
dir /= lenDir; // it looks cool if you comment this out!
}
vec2 uvNearerFaceCenter = uv - dir * 100.0 * pixel;
float face = getFace(uv) + getFace(uvNearerFaceCenter);
if (face > 0.0) {
vec2 target = uv + dir * (20.0 * pixel); // grab the color 20px away from your face center
color = getPrevious(target);
}
gl_FragColor = vec4(color.x, color.y * 1.08, color.z, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment