WebGL moon shader

Shows how to create a lit sphere with just one vertex and a custom shader. The demo creates a few point sprites and an animated point light circling around the “spheres”. Saves a lot of geometry!

Of course, if the viewer moves with respect to the geometry, you still see the same texture. So it is perfect for rendering the moon, which always shows the same face to us.

Open demo in new browser tab

To examine the source code, right-click into the browser window, where your browser should offer you to view the source of the current frame.