/gpu_arcs_example.glsl Secret
Last active
October 26, 2024 01:10
BFCM Globe 2023: GPU Arcs
This file contains 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
vec3 cubicBezier(vec3 startPoint, vec3 midCoord1, vec3 midCoord2, vec3 endPoint, float t) { | |
float u = 1.0 - t; | |
float tt = t * t; | |
float uu = u * u; | |
float uuu = uu * u; | |
float ttt = tt * t; | |
vec3 p = uuu * startPoint; | |
p += 3.0 * uu * t * midCoord1; | |
p += 3.0 * u * tt * midCoord2; | |
p += ttt * endPoint; | |
return p; | |
} | |
vec3 cubicBezierTangent(vec3 startPoint, vec3 midCoord1, vec3 midCoord2, vec3 endPoint, float t) { | |
// ... tangent calculation used for making arcs always face the viewer | |
} | |
vec3 curvePosition = cubicBezier(startPos, midCoord1, midCoord2, endPos, uv.y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment