WebGL planet


Here is a little webGL demo I have started working on, based on something I did in 1997. Back then I had to precalculate images to make an animation though.

This planet is made of about 200 thousand triangles. The triangles are generated along layers. Compared to subdividing an icosahedron and projecting on a sphere this method generates triangles that are more uniform in size, though they are less equilateral.

The terrain is generated by displacing vertices along the normal to the sphere using a sum of sine functions of x, y and z. Colors are simply function of the altitude.

If your device can handle it, check out the nicer looking high polygon count version (over one million triangles).

You can find the source on github.

Acknowledgments to http://learningwebgl.com/blog/ for much of the code.

Leave a Reply