Created
January 13, 2017 01:40
-
-
Save ayamflow/3189404c767facc6d8c74b79dac7ac88 to your computer and use it in GitHub Desktop.
Spherical mapping
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
// from inear | |
http://www.inear.se/2011/09/set-a-sphere-on-fire-with-three-js/ | |
float PI = 3.14159265; | |
float TWOPI = 6.28318531; | |
float BaseRadius = 1.0; | |
vec3 sphere( float u, float v) { | |
u *= PI; | |
v *= TWOPI; | |
vec3 pSphere; | |
pSphere.x = BaseRadius * cos(v) * sin(u); | |
pSphere.y = BaseRadius * sin(v) * sin(u); | |
pSphere.z = BaseRadius * cos(u); | |
return pSphere; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment