In lesson 20 we finally move from 2D graphics to 3D graphics. Specifically we go from flat disks to spheres.

To do this we just use some high school math. For a sphere of radius `r`

, you probably learned in high school that for any point (x,y,z) on the sphere surface the following is true:

x^{2} + y^{2} + z^{2} = r^{2}

From there it is pretty easy to show that if you already know `x`

,`y`

and `r`

, you can find `z`

by:

z = sqrt(r^{2} - x^{2} - y^{2})

We use this formula to create a sphere, which we will do cool things with in coming lessons.

You can see this lesson by CLICKING HERE.

Again, so FUN!!!

> float radius = 0.2 * sin(uTime * 1.7 + 2.3* noise(vPos)) + 0.5; // radius OF SPHERE

This is great!!