Last active
November 6, 2025 13:30
-
-
Save rileyjshaw/4288ea4c39cc9039c060f884363d2cef to your computer and use it in GitHub Desktop.
Predator (1987) camo sketch for ShaderBooth (https://shaderbooth.com/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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