Skip to content

Instantly share code, notes, and snippets.

@drewgillievfx
Created May 10, 2020 17:00
Show Gist options
  • Save drewgillievfx/147be8e57a1f42a14bb5c2be908837bf to your computer and use it in GitHub Desktop.
Save drewgillievfx/147be8e57a1f42a14bb5c2be908837bf to your computer and use it in GitHub Desktop.
shader
Padding(float freq1 = 10,
float freq2 = 10,
float maxB = .25,
color minColor = color(0,0,0),
color maxColor = color(1,1,1),
float s = 0 [[int lockgeom = 0]],
float t = 0 [[int lockgeom = 0]],
output color resultRGB1 = 0,
output color resultRGB2 = 0,
output color resultRGB3 = 0)
{
float sinval = sin(s * 2 * M_PI * freq1);
// Remap from -1 to +1 to 0 to 1
float alpha = (sinval + 1) * .5;
resultRGB1 = mix(minColor, maxColor, alpha);
point p = transform("world", P);
float blend = smoothstep(freq1, freq2, p[1]);
resultRGB2 = mix(minColor, resultRGB1, blend);
// float blend2 = smoothstep(freq1, freq2, s);
resultRGB3 = mix(sinval, resultRGB2, blend);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment