Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created June 24, 2026 10:41
Show Gist options
  • Select an option

  • Save jacobsapps/d3321158b5257e5500267d286a34f1f2 to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/d3321158b5257e5500267d286a34f1f2 to your computer and use it in GitHub Desktop.
Grain from My top 3 design “Kisses” I like to add to every app
#include <metal_stdlib>
using namespace metal;
[[ stitchable ]] half4 grain(float2 position, half4 color, float amount, float time) {
float noise = fract(sin(dot(floor(position), float2(12.9898, 78.233)) + time) * 43758.5453);
return half4(color.rgb + half3((noise - 0.5) * amount), color.a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment