Skip to content

Instantly share code, notes, and snippets.

@CedricGuillemet
Created July 17, 2020 09:19
Show Gist options
  • Save CedricGuillemet/1244f221831c85baf730b4c2213e33fc to your computer and use it in GitHub Desktop.
Save CedricGuillemet/1244f221831c85baf730b4c2213e33fc to your computer and use it in GitHub Desktop.
if (sphereDistance(currentPosition, sphereCenter, 1.0) < 0.) {
vec3 normal = (currentPosition - sphereCenter);
float dotLight = dot(normal, ligthDirection) * 0.5 + 0.5;
float noiseTexture = simplex3d(currentPosition * 4.0) * 0.5 + 0.5;
gl_FragColor = vec4(vec3(1.0, 0.5, 0.2) * dotLight * noiseTexture, 1.0);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment