Adding stars
Adding stars
Hi Chris,
I've been enjoying the app for some time now, and I didn't even know about this forum until now. (I'm the one who originally suggested anti-aliasing of lines)
This may be a stupid question:
I've seen how it's possible to add moons and other objects to planets and stars in the 'extras' directory... but how would you go about adding an actual star to the collection (be it real or fictitious)? Is it a similar process via the extras directory?
-Dmitry Brant
I've been enjoying the app for some time now, and I didn't even know about this forum until now. (I'm the one who originally suggested anti-aliasing of lines)
This may be a stupid question:
I've seen how it's possible to add moons and other objects to planets and stars in the 'extras' directory... but how would you go about adding an actual star to the collection (be it real or fictitious)? Is it a similar process via the extras directory?
-Dmitry Brant
Adding Planets & Moons is quite simple - just make a new .ssc file in the extras directory and add Planets/Moons like this:
"nameOfTheNewPlanet" "Starname"
{
Texture "texturefile"
Radius 2440
CustomOrbit "yourplanet"
EllipticalOrbit {
Period 0.2408
SemiMajorAxis 0.3871
Eccentricity 0.2056
Inclination 7.0049
AscendingNode 48.33167
LongOfPericenter 77.456
MeanLongitude 252.251
}
RotationPeriod 1047.509
Obliquity 7.01
LongOfRotationAxis 228.31
Albedo 0.06
}
These are the orbit values for mercury, just change them, play around a bit.
And look in the solarsys.ssc for moons/spacecraft/other options...
It's all quite self-explanatory.
Adding stars is a bit more difficult, you have to modify the stars.dat
To add one star, you'd have to increase the first four bytes by one (as an int32) and add 25 bytes describing the star position/type/brightness at the end (the description is somewhere in the docs, but there is a mistake: there are TWO catalogue numbers in the stars.dat, not just one as stated in the docs.
But it is propably better to use the stars already contained, there are 100000 unused stars in celestia, you'll surely find on that you like :-)
Sirius
"nameOfTheNewPlanet" "Starname"
{
Texture "texturefile"
Radius 2440
CustomOrbit "yourplanet"
EllipticalOrbit {
Period 0.2408
SemiMajorAxis 0.3871
Eccentricity 0.2056
Inclination 7.0049
AscendingNode 48.33167
LongOfPericenter 77.456
MeanLongitude 252.251
}
RotationPeriod 1047.509
Obliquity 7.01
LongOfRotationAxis 228.31
Albedo 0.06
}
These are the orbit values for mercury, just change them, play around a bit.
And look in the solarsys.ssc for moons/spacecraft/other options...
It's all quite self-explanatory.
Adding stars is a bit more difficult, you have to modify the stars.dat
To add one star, you'd have to increase the first four bytes by one (as an int32) and add 25 bytes describing the star position/type/brightness at the end (the description is somewhere in the docs, but there is a mistake: there are TWO catalogue numbers in the stars.dat, not just one as stated in the docs.
But it is propably better to use the stars already contained, there are 100000 unused stars in celestia, you'll surely find on that you like :-)
Sirius
curious
I don't think it should have to be this difficult to add a new star (or modify the parameters of existing stars). I can create a simple app that would be able to append an entry to stars.dat... or the app could just be an 'explorer' of stars.dat, where you could add or modify stars' parameters.
Would this be worth doing?
-Dmitry Brant
Would this be worth doing?
-Dmitry Brant
It would be nice if we could add stars in bulk, using catalog data. We could play around with how many stars Celestia can handle and maybe some of the programmer-types could figure out how to up this number. Also users of more powerful computers could use their increased CPU power to explore better-looking galaxies and whatnot.
It's not too difficult if you can program (see thread http://www.shatters.net/forum/viewtopic.php?t=277 )
I am already working on a semirandom star generator that can simulate the galactic distribution of stars, but I think for new creations (planetary systems... ) real stars would be better. (Think, the actual star database has approximately 100000*25+4 bytes = 2,5 MB
if you want to add a new star, you'd have to redistribute the whole 2.5 MB. (Though, it would be not bad to make a browser to the stardb, could come in handy for development)
Perhaps we could also prog an install system that automatically adds and manages virtual stars, so that "star files" could be distributed without sending the whole db...
Sirius
P.S.: I once started celestia with 5 Million!! Stars! It took perhaps 1 minute to start up but the performance was good ... 2 -5 fps!! (for 5 Million stars that's not bad!)
I am already working on a semirandom star generator that can simulate the galactic distribution of stars, but I think for new creations (planetary systems... ) real stars would be better. (Think, the actual star database has approximately 100000*25+4 bytes = 2,5 MB
if you want to add a new star, you'd have to redistribute the whole 2.5 MB. (Though, it would be not bad to make a browser to the stardb, could come in handy for development)
Perhaps we could also prog an install system that automatically adds and manages virtual stars, so that "star files" could be distributed without sending the whole db...
Sirius
P.S.: I once started celestia with 5 Million!! Stars! It took perhaps 1 minute to start up but the performance was good ... 2 -5 fps!! (for 5 Million stars that's not bad!)
-
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 9 months
- Location: Seattle, Washington, USA
Sirius wrote:P.S.: I once started celestia with 5 Million!! Stars! It took perhaps 1 minute to start up but the performance was good ... 2 -5 fps!! (for 5 Million stars that's not bad!)
I think that better performance should be possible with a 5 million star database, but it depends on how many stars are visible at one time. Using a stellar distribution similar to what we see within 1000 ly of the Sun, I wouldn't expect much difference between a 100,000 and 5 million star catalog.
The long startup time is the result of some fairly involved processing to organize the stars into an octree structure for fast visibility determination when rendering. Eventually, I want to store the prebuilt star database to shorten Celestia's startup time. This is why I haven't added any sort of easy to modify text format for adding additional stars (though I actually it wouldn't be too difficult to add a modest number of custom stars to a prebuilt octree.)
--Chris
Anonymous wrote:I use c++ for the random generator and AXE as an hexed (for analyzing).
I don't know where you can find it, the website is down.
Sirius
Thanks I use HEX workshop...
Looking at the data in the HEX editor reminds me of programming back in the days of the vic 20 or commodore 64 using assebler...hehe assebly is easier...
Ok now the first hex is a long or unsigned long pointing to the amount of stars in the catalogue...correct? This number being 112521?
Ok now how would I go about adding a new star? I suspect its not as simple as increasing the hex value of the long 112521 by long 1...and then appending the data at the end would it? And in doing so...what data WOULD I append?...
Hex is greek to anyone without a map of how its laid out...
I'm trying to teach the cavemen how to play scrabble, its uphill work. The only word they know is Uhh and they dont know how to spell it!
1st: Increase it by one :-)
then append 25 bytes:
4 bytes with a hipparcos catalogue number (int32)
4 bytes with a "HP" catalogue number (also int32)
4 bytes (float) with the rectascension (<- is this spelled correctly?)
4 bytes (float) with the declination
4 bytes (float) for the parallax
2 bytes for the apparent magnitude (int16)
2 bytes for the stellar class (int16)
1 Byte for the parallax error (not very important, take sth like 16)
-----
25 bytes
you can then select your star by typing in "HIP <cataloguenumber>" (in celestia)
I hope now it's more like english :-)
Sirius
then append 25 bytes:
4 bytes with a hipparcos catalogue number (int32)
4 bytes with a "HP" catalogue number (also int32)
4 bytes (float) with the rectascension (<- is this spelled correctly?)
4 bytes (float) with the declination
4 bytes (float) for the parallax
2 bytes for the apparent magnitude (int16)
2 bytes for the stellar class (int16)
1 Byte for the parallax error (not very important, take sth like 16)
-----
25 bytes
you can then select your star by typing in "HIP <cataloguenumber>" (in celestia)
I hope now it's more like english :-)
Sirius
Ok Ive looked this over and I dont get what you mean by 4 bytes...How can 4 bytes fit when its actually 16 byte segments? 4 bytes is a range of -7 to 7 or unsigned 0-15...hence 0-F in Hex...so a number...especially a float isn't going to fit in 4 bytes...then 2 bytes and then 1...Do you mean the 4 hex codes like FFFF is 4 F's or 4 bytes by your terminology?
Heres the first line of Hex in stars.dat
89B7 0100 0100 0000 BC6D 0300 C4F8 7E38
Heres the first 2 entries in starnames.dat
0:Sol
88:TAU Phe
If anyone could help me decipher this...let me know...
Thanks!
Heres the first line of Hex in stars.dat
89B7 0100 0100 0000 BC6D 0300 C4F8 7E38
Heres the first 2 entries in starnames.dat
0:Sol
88:TAU Phe
If anyone could help me decipher this...let me know...
Thanks!
I'm trying to teach the cavemen how to play scrabble, its uphill work. The only word they know is Uhh and they dont know how to spell it!
-
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 9 months
- Location: Seattle, Washington, USA
I'll warn everyone that adding stars by hand with a hex editor is extremely painful. You really want to write code to do this . . .
The first four bytes of stars.dat is a 32-bit count of the number of stars in the file. After that come a series of 25 byte star records.
Each star record is of the following form:
4 bytes (int): HIPPARCOS catalog number
4 bytes (int): HD catalog number
4 bytes (float): Right Ascension
4 bytes (float): Declination
4 bytes (float): Parallax in seconds
2 bytes (int): Apparent magnitude
2 bytes (int): Stellar class
1 byte (int): parallaxError
If you're adding custom stars, you can always set the parallax error to zero.
Right Ascension is specified in hours, so 12h 30m would be 12.5.
Parallax is in seconds. The distance of the star from the Earth is therefore 1.0 / parallax parsecs (1 parsec == 3.26 light years.)
The apparent magnitude of the star is stored in 8.8 fixed point. So, in hex, a magnitude 1.0 star would have the value 0x0100 stored in the file. Again, this is apparent, not absolute, magnitude i.e. how bright the star would appear from Earth (well, from (0, 0, 0))
The high four bits (12 - 15) of the stellar class field are the star type:
Normal: 0
White dwarf: 1
Neutron star: 2
Black hole: 3
The next four bits (8 - 11) are the spectral class:
O: 0
B: 1
A: 2
F: 3
G: 4
K: 5
M: 6
R: 7
S: 8
N: 9
WC: 10
WN: 11
Unknown: 12
The next four bits (4 - 7) are the subclass, from 0 to 9
The low four bits (0 - 3) are the luminosity class:
Ia-0 (supergiant) : 0
Ia (supergiant) : 1
Ib (supergiant) : 2
II (bright giant) : 3
III (giant) : 4
IV (subgiant) : 5
V (dwarf, main-sequence star) : 6
VI (subdwarf) : 7
The Sun is a type G2V star; it's stellar class value in stars.dat would therefore be (in hex): 0426 Betelguese is an M1 Ia star, so it's stellar class is 0611
Someday, there will be a better way to do all this :> And the star format won't be so Earth-centric.
--Chris
The first four bytes of stars.dat is a 32-bit count of the number of stars in the file. After that come a series of 25 byte star records.
Each star record is of the following form:
4 bytes (int): HIPPARCOS catalog number
4 bytes (int): HD catalog number
4 bytes (float): Right Ascension
4 bytes (float): Declination
4 bytes (float): Parallax in seconds
2 bytes (int): Apparent magnitude
2 bytes (int): Stellar class
1 byte (int): parallaxError
If you're adding custom stars, you can always set the parallax error to zero.
Right Ascension is specified in hours, so 12h 30m would be 12.5.
Parallax is in seconds. The distance of the star from the Earth is therefore 1.0 / parallax parsecs (1 parsec == 3.26 light years.)
The apparent magnitude of the star is stored in 8.8 fixed point. So, in hex, a magnitude 1.0 star would have the value 0x0100 stored in the file. Again, this is apparent, not absolute, magnitude i.e. how bright the star would appear from Earth (well, from (0, 0, 0))
The high four bits (12 - 15) of the stellar class field are the star type:
Normal: 0
White dwarf: 1
Neutron star: 2
Black hole: 3
The next four bits (8 - 11) are the spectral class:
O: 0
B: 1
A: 2
F: 3
G: 4
K: 5
M: 6
R: 7
S: 8
N: 9
WC: 10
WN: 11
Unknown: 12
The next four bits (4 - 7) are the subclass, from 0 to 9
The low four bits (0 - 3) are the luminosity class:
Ia-0 (supergiant) : 0
Ia (supergiant) : 1
Ib (supergiant) : 2
II (bright giant) : 3
III (giant) : 4
IV (subgiant) : 5
V (dwarf, main-sequence star) : 6
VI (subdwarf) : 7
The Sun is a type G2V star; it's stellar class value in stars.dat would therefore be (in hex): 0426 Betelguese is an M1 Ia star, so it's stellar class is 0611
Someday, there will be a better way to do all this :> And the star format won't be so Earth-centric.
--Chris
Actually studying the way its set up...Its impossible to add direct hex to reflect long and double variables...All those instances will have to be added with a program...I just need to hunt down my Visual Studio...
I was thinking of using Visual Basic...but its limited on variables...There is no float in Visual B...Only Double and Currency...so I guess I will use VC when I load it up...
Thanks for clarifying that Chris!
I was thinking of using Visual Basic...but its limited on variables...There is no float in Visual B...Only Double and Currency...so I guess I will use VC when I load it up...
Thanks for clarifying that Chris!
I'm trying to teach the cavemen how to play scrabble, its uphill work. The only word they know is Uhh and they dont know how to spell it!
-
- Posts: 5
- Joined: 11.06.2002
- With us: 22 years 5 months
- Location: Melbourne, Australia
starFiles
Chris,
Ive noticed that you have added support to load stars from text files in the extras directory. Could you please post some examples or explain how to create these files?
Ive noticed that you have added support to load stars from text files in the extras directory. Could you please post some examples or explain how to create these files?
Marc Griffith
http://mostlyharmless.sourceforge.net
http://mostlyharmless.sourceforge.net
Add them in like galaxies...
Spectural type as defined above...
Code: Select all
# Sirius B
300001 {
RA 101.2886
Dec -16.71314306
Distance 8.601223
SpectralType "D"
AppMag 15
}
Spectural type as defined above...
I'm trying to teach the cavemen how to play scrabble, its uphill work. The only word they know is Uhh and they dont know how to spell it!
Rassilon wrote:Add them in like galaxies...Code: Select all
# Sirius B
300001 {
RA 101.2886
Dec -16.71314306
Distance 8.601223
SpectralType "D"
AppMag 15
}
Spectural type as defined above...
Thanks Rass,
Ill repeat how to do it so others have no problems.
I added the above code to a file called sirus b.stc and put it in the extras directory.
I also added this
Code: Select all
300001::Sirius B
to the end of the starnames.dat file to give the new star a meaningful name.
It would be nice to include additional names for the star in the *.stc file. Possible?
-
- Posts: 79
- Joined: 30.01.2002
- With us: 22 years 9 months
- Location: Villaviciosa de Od?n, Madrid, Spain
What about...?
It's nice to be able to add stars, but it would be nicer to be able to add them just like planets. The orbital parameters of certain double systems are known. That would be spectacular!
Greetings.
Bruckner
Greetings.
Bruckner
- t00fri
- Developer
- Posts: 8772
- Joined: 29.03.2002
- Age: 22
- With us: 22 years 7 months
- Location: Hamburg, Germany
What about...?
bruckner wrote:It's nice to be able to add stars, but it would be nicer to be able to add them just like planets. The orbital parameters of certain double systems are known. That would be spectacular!
Greetings.
Bruckner
I am thinking since quite some time whether it is not time again for us "Perl-addicts" to scan the Washington double star catalog in order to extract the missing partners and their orbital parameters as far as they are known;-)
Bye Fridger