Being interested in astronomy issues #94 to #97 and in particular issue #96 caught my eye.
As I begin getting acquainted with the codebase and all things Terasologicals, I thought I'd start a discussion on the issue so that (ideally) by the time I can write some code, we are all happy with what is supposed to be implemented.
The first thing I thought is that all these issues, in particular #94 to #97, are really just one: we need a system to show things in the sky that are fundamentally unrelated to the geometry of the world. Of course we could just have a single texture mapped on a rotating sphere and just live with that. But that isn't particularly flexible, is it?
A Skysphere module that allows separate (user-generated?) sub-modules sounds more flexible to me. One sub-module could be responsible for solar system objects (sun(s), planets, moon(s), comets, asteroid belts), one submodule could be responsible for the background stars and other modules could take care of meteors and northern lights as mentioned in issue #97. If necessary, features of each submodule could be disabled, to allow for a more specialized submodule to do its job. I.e. the solar-system submodule might get sun and moon disabled so that a more specialized submodule can better deal with things such as eclipses.
I don't know enough of Terasology's rendering pipeline but the way I think of it is that each module should define a mini-scene to be rendered in a context that is completely separate from the world's rendering context. For example the solar system submodule would provide an actual 3d, animated solar system ready to be rendered, the camera positioned on the appropriate planet and oriented according to the player's look vector. Similarly the stars submodule would provide a number of stars positioned in a 3D space, ready to be rendered. Interestingly, with this kind of 3D-driven approach, a few things would occur "for free", i.e. eclipses and the subtle parallax effect that allows near star distances to be calculated (why would you want to do that is a different matter). Also, if traveling to other planets was to be allowed (even by just using portals), providing an updated planetary view would be just a matter of changing the position of the camera in the miniature solar system.
How each submodule defines the data and its appearance would be up to the submodule. I.e. a submodule could define just planet position as a function of time, while asset-only submodules would provide the actual models and textures for planets, stars and whatelse. Another submodule could provide an all-in-one package instead. What's important is that they all provide a scene to be rendered, the rendering order of each scene being defined in the skysphere module.
Submodules could also send events if it is warranted. I.e. a meteor module could send an event detailing the characteristics of a fireball crossing the sky so that the world can be suddenly lit up accordingly. Modules could also detect events such as alignments and eclipses and inform whatever subscribing system would like to be notified. Also, submodules should provide their own API, so that things such as flaring a star on demand or perhaps accelerating time so that planets move at dizzying speed or even stopping time so that it's always daytime, become possible.
It's 3:27am and -perhaps- it's time I go to bed. I'll start to detail some of the submodules in a further post in this thread over the next few days. What would be interesting is to get some early feedback. Is the overall picture a reasonable/feasible one? Especially the idea of multiple rendering contexts? Also, besides nearby objects (suns/planets/moons/comets/asteroid belts), deep space objects (stars/galaxies/nebulaes) and upper-atmospheric events such as northern lights and meteors, what else would you like to see up there?
By the way. Who said Terasology should be a planet? Could it be a large moon orbiting a gas giant instead? Might the giant have rings, like saturn? Or might Terasology itself have rings? I guess for once the sky -isn't- the limit!
Ciao!
Manu
As I begin getting acquainted with the codebase and all things Terasologicals, I thought I'd start a discussion on the issue so that (ideally) by the time I can write some code, we are all happy with what is supposed to be implemented.
The first thing I thought is that all these issues, in particular #94 to #97, are really just one: we need a system to show things in the sky that are fundamentally unrelated to the geometry of the world. Of course we could just have a single texture mapped on a rotating sphere and just live with that. But that isn't particularly flexible, is it?
A Skysphere module that allows separate (user-generated?) sub-modules sounds more flexible to me. One sub-module could be responsible for solar system objects (sun(s), planets, moon(s), comets, asteroid belts), one submodule could be responsible for the background stars and other modules could take care of meteors and northern lights as mentioned in issue #97. If necessary, features of each submodule could be disabled, to allow for a more specialized submodule to do its job. I.e. the solar-system submodule might get sun and moon disabled so that a more specialized submodule can better deal with things such as eclipses.
I don't know enough of Terasology's rendering pipeline but the way I think of it is that each module should define a mini-scene to be rendered in a context that is completely separate from the world's rendering context. For example the solar system submodule would provide an actual 3d, animated solar system ready to be rendered, the camera positioned on the appropriate planet and oriented according to the player's look vector. Similarly the stars submodule would provide a number of stars positioned in a 3D space, ready to be rendered. Interestingly, with this kind of 3D-driven approach, a few things would occur "for free", i.e. eclipses and the subtle parallax effect that allows near star distances to be calculated (why would you want to do that is a different matter). Also, if traveling to other planets was to be allowed (even by just using portals), providing an updated planetary view would be just a matter of changing the position of the camera in the miniature solar system.
How each submodule defines the data and its appearance would be up to the submodule. I.e. a submodule could define just planet position as a function of time, while asset-only submodules would provide the actual models and textures for planets, stars and whatelse. Another submodule could provide an all-in-one package instead. What's important is that they all provide a scene to be rendered, the rendering order of each scene being defined in the skysphere module.
Submodules could also send events if it is warranted. I.e. a meteor module could send an event detailing the characteristics of a fireball crossing the sky so that the world can be suddenly lit up accordingly. Modules could also detect events such as alignments and eclipses and inform whatever subscribing system would like to be notified. Also, submodules should provide their own API, so that things such as flaring a star on demand or perhaps accelerating time so that planets move at dizzying speed or even stopping time so that it's always daytime, become possible.
It's 3:27am and -perhaps- it's time I go to bed. I'll start to detail some of the submodules in a further post in this thread over the next few days. What would be interesting is to get some early feedback. Is the overall picture a reasonable/feasible one? Especially the idea of multiple rendering contexts? Also, besides nearby objects (suns/planets/moons/comets/asteroid belts), deep space objects (stars/galaxies/nebulaes) and upper-atmospheric events such as northern lights and meteors, what else would you like to see up there?
By the way. Who said Terasology should be a planet? Could it be a large moon orbiting a gas giant instead? Might the giant have rings, like saturn? Or might Terasology itself have rings? I guess for once the sky -isn't- the limit!
Ciao!
Manu