5

I would like to create a browser based, interactive, realtime animation, showing the Earth as it goes around the sun, depending on the time of day and time of year. This animation should also (eventually) show the other planets in the solar system and the user should be able to pan around the solar system and see it from different sides (by click-drag, scroll etc.).

I wouldn't think it has any real practical application, but I like the artistic value found in the universe...so it would be interesting to start doing it and I'll probably learn a few things while doing this.

I don't have any experience with planetary physics, although I'd probably understand it if given a good source of information. I do have some experience with web development, with languages like JavaScript, HTML, CSS, Python.

Now, questions:

  • Most importantly, how would I begin a project such as this?

  • Where do I get the information about the rotation of the Earth and the other planets in the solar system?

  • What languages should I use/learn?

  • What other thoughts do you have about this idea? What functionality do you think would be interesting for a project such as this?

This idea is very much impulse driven, especially at this late hour of the day...as I'm looking out the window and seeing the buildings getting darker and darker, I'm also imagining how the Earth is slowly spinning around itself and also around the Sun and I think it would be a very nice sight to be able to see this from an outside perspective.

Hope to get some feedback. Cheers!

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Alex
  • 7,432
  • 20
  • 75
  • 118
  • Not a SO question as there is no answer. The user doesn't even want it for any particular reason such as solving a real work issue in what is being developed. Someone with higher permission than me close it down please. – PurplePilot Aug 30 '10 at 19:26
  • 6
    @Purple, it is not a criteria for valid SO questions to have "real world applicability". Fair enough, the question is quite vague and it has no single definitive answer. Still, IMHO this in itself is no justifiication for closing it down. [Let's be nice :-)](http://stackoverflow.com/faq) – Péter Török Aug 30 '10 at 19:35
  • 2
    well, there's a proposal for Astronomy StackExchange site, so you could tackle the problem domain there when it launches. As for how it can be done, check out Stellarium: http://www.stellarium.org/ - (open source) – Piskvor left the building Aug 30 '10 at 19:37
  • 1
    No answer cause you don't know any...cause it's not a project, paid by a customer. It's called being imaginative about something, trying to create something that is beautiful with the means of programming languages and modern technology. Yes, I don't know where to begin with a project of this magnitude, but I'm sure there are some people here that can give me pointers of what languages, frameworks and sources to use in order to build this. Don't be so quick to dismiss things just because they don't "solve a real work issue". ...edited this part out to be 'nicer'... – Alex Aug 30 '10 at 19:38
  • @Piskvor - That looks interesting, however, it is not exactly what I'm looking for. That is more of how you see the sky from Earth, I'm trying to show the solar system from an outside of earth perspective, by seeing all the planets go around the Sun. – Alex Aug 30 '10 at 19:48
  • @Andrei: Don't worry, for questions that are not in the "main stream" ("how to do X in language Y"), it may take a while to get answers. (btw, many things you see around here aren't paid projects) – Piskvor left the building Aug 30 '10 at 19:48
  • 1
    I am not a web developer, so I can't advise you on specific web technologies and stuff. However, in general, IMO the best way is to start small, and add features gradually. I.e. first implement a view of a central sphere, and another one orbiting around it on an elliptical trajectory. Then put textures on their surface. Next, add pan/zoom. Etc. – Péter Török Aug 30 '10 at 19:50
  • 1
    @Andrei: well, I'm thinking along the way "it generates a view of the sky from coordinates X,Y,Z somewhere in space (relative to the Sun? Maybe.); maybe it could be changed so that the coordinates are not on Earth's orbit, and add Earth as another planet" – Piskvor left the building Aug 30 '10 at 19:51
  • @Jesse, if you would have just said: "OpenGL is not an option because it only targets WebKit", that would have been enough. You could have spared me the Christ's sake argument there. I didn't ask anybody how they felt about my project. I feel right about it, I just need to know what languages/tools I could use, to start researching them. Jesus, SO might be a good place to ask specific questions, but if something outside of the thinking box comes along, it's a skirmish of complaints: "it's not right, it doesn't follow all the other 10 million questions' format on here" – Alex Aug 30 '10 at 19:54
  • 1
    You usually won't like every answer you get; and you won't like some of the questions. No need to start a flamewar over that, no? While the question could have been more specific, some reactions might have been more civil - being nice to newcomers and all that. If anyone still needs to discuss the site's mechanisms, there's the metaSO for that: http://meta.stackoverflow.com/ – Piskvor left the building Aug 30 '10 at 20:05
  • 1
    You might want to have a look at [Celestia](http://www.shatters.net/celestia/) which is also open-source and should be exactly the direction you want to go. – Felix Kling Aug 30 '10 at 20:10
  • 1
    Excuse me but when you ask an SO question the guidelines go "How to Ask Is your question about programming? We prefer questions that can be answered, not just discussed." It isn't even a question it's maybe 1/2 dozen questions and it certainly doesn't have an answer because all the replies talk about very broad brush aspects such as project planning and learning Javascript.So in all those respects it fails the SO test. Andrei then comes back and is just rude to me saying that i wouldn't know how to answers it because i have no imagination and he is just trying to create something beautiful. – PurplePilot Aug 30 '10 at 21:57

3 Answers3

3

Sounds like a cool project! The kind I would be inspired to work on (and rarely finish ;-).

See this related question on graphical frameworks for browsers.

I'd start with, what is your audience? E.g. most internet users and most major browsers?

My preference would be to use O3D (based on WebGL), but that requires that you don't mind that your work of art only runs in bleeding-edge browsers and not in IE. The programming would be done in JavaScript. However it would be challenging. My next question would be, in the cold light of morning, am I still inspired enough about this project to invest significant time learning languages and graphics libraries?

Another question is, are you looking to do this in 3D? It sounds like it, but there is aesthetic value in a 2D representation of the solar system as well, so it's worth asking.

If you're not already experienced in programming or 3D graphics, you might consider Processing. It's aimed at artists rather than programmers, and it has applets to run in browsers.

For planets you'll basically be doing textured spheres, at least to start; see this tutorial for WebGL or these samples for O3D.

Also do a search for open-source solar system simulation projects... there are plenty of them, and you can steal the math algorithms. :-)

Community
  • 1
  • 1
LarsH
  • 27,481
  • 8
  • 94
  • 152
  • Wow..thanks. Good answer. I definitely got a lot of stuff I can look up now and I totally get what you're saying about this being an evening project, but in the morning things might be different. Well, I still have a couple of projects going on at the moment, but I was interested for some time in doing something like this, so I guess the first chance I get in the near future to start working on this, I'll take it. Also, what do you mean by aesthetic value in 2D representation? Are you referring to a sort of top view of the solar system? My first thought was 3D. Could you expand on that idea? – Alex Aug 30 '10 at 20:58
  • @Andrei - yes, by 2D I meant sort of top-down. Something like http://janus.astro.umd.edu/javadir/orbits/ssv.html, although that one is not focused on aesthetics. Another consideration is scale. If you zoom out to see the whole SS, there will be practically no detail on any planet... no moons or texture. So consider what it you want to show. One option is to show the view from a spacecraft zooming through the SS, approaching one planet at a time. – LarsH Aug 30 '10 at 22:25
2

That's a lot of questions for one question ;)

Anyway, I'd do some planning first: divide the big task into subtasks (e.g. celestial mechanics ("how do the planets move" - see e.g. here), representing that in code, rendering that in 3D, texturing and shading, animation?) and start researching/working on those, check back here when you run into problems. The language doesn't matter, really - anything that allows you to render 3D scenes will do.

Maybe you could adapt Stellarium to your project - it does, after all, offer a view from some point in space in some direction. Its purpose is the other way - looking from Earth outwards, but I'd say a code fork may be feasible.

Community
  • 1
  • 1
Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222
2

If I was going to do this, I'd start by learning how to use the Javascript canvas element to draw things. Write some code to draw some circles/ellipses on the screen for planetary positions. Then add some animation. Finally, I'd figure out how to do all the celestial mechanics calculations in Javascript.

Others might start with the celestial mechanics, and figure out the graphics later. Just choose which part you find "interesting", and dive in.

Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
  • Excellent, thanks for the clear answer. So I understand from this that the JS canvas would be appropriate for 3D rendering? – Alex Aug 30 '10 at 19:58
  • Or, I guess 3D rendering is just showing 2D images depending on your perspective point. – Alex Aug 30 '10 at 20:09
  • 1
    3D rendering will be a *lot* easier if you have a framework for 3D rendering, than if you try to use a 2D framework for 3D. Unless you want to reinvent many wheels. That's why I would recommend O3D/WebGL (see my answer). – LarsH Aug 30 '10 at 20:24