art with code

2010-12-19

WebGL Orrery


I wrote a small WebGL orrery a month back or so, using planet and orbit data from Wikipedia. The orbits came out a bit wrong (planet positions on orbits are wrong, the planet rotation axis rotates along the orbit, planets velocities are constant, the orbits / axes may well be flipped somewhere), but it's a passably "realistic" orrery. Well, realistic apart from the whole having to scale down orbits by a factor of thousand to make the planets visible -thing. With 1:1 orbits, the planets are smaller than a pixel in size when viewed from other planets and the sun is about a pixel in diameter when viewed from Neptune.

It's quite extensible too, it should be possible to add in all the moons just by filling in their data. The coordinate system and z-buffer aren't accurate enough to do anything fancy like a spaceship sim with 1:1 orbits though :)

2 comments:

Evgeny said...

Very nice. Why sun is white (should be yellow). I was searching zoom control for several minutes.
Sorry. Couldn't you send me your performance results for "N-Body toy" http://www.ibiblio.org/e-notes/webgl/gpu/n-toy.html (I've made a link to your Orrery here :)

Ilmari Heikkinen said...

Hey, thanks! Yeah, I should put some visible zoom controls there.

The sun is white because there's no atmosphere to scatter off the blue light.

N-Body: 2.4 fps on Radeon HD4200 integrated graphics... I think I got something like 25 fps on a HD4850.

Blog Archive