Tutorial - How to add a new texture to existing or new stars

All tutorials about Celestia go in here. For Celestia itself, add-ons, textures, scripting, etc.
Avatar
Topic author
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Tutorial - How to add a new texture to existing or new stars

Post #1by fsgregs » 14.07.2008, 19:57

EDITED: Hi everyone:

A lot of folks (including me) have been interested in adding new textures to existing stars or to new fictional stars they've just made up. It can be done. Here is an example of a new texture overlaid onto Gliese 581, a red dwarf about 20 LY from Earth.

g581.jpg

A lot of folks have been confused on how to do this. At present, there is no current ability in Celestia 1.5.1 or 1.4.1 to "modify" a star entry in the database to add a texture. To do so, you have to create an add-on that contains the texture, and a star file called an ".stc" file, which tells Celestia what texture to add to a particular star. The process is not difficult, but can be confusing and a bit time-consuming, so I am offering this to you to explain how to do it. So ... here goes:

To Add a Different Texture to an Existing Star:

1. Create a folder for the texture add-on, name it whatever you want, and place it into your extras folder.
2. Create a sub-folder inside that named "textures".
3. Create a sub-folder inside the "textures" folder named "medres". Into it, place the star texture you wish to use. Make sure that texture is in the correct size format.
4. Copy these lines (in the quote box below) into a text file, and name it "starname.stc", where starname is the name of the star you are modifying. Substitute new values for each of 7 lines (including the top line)

74995 "name" --- # the number is the HIP # for the star, and the name in quotes is any name you wish to add. If you don't wish to add a name, leave it out (list only the number)
{
RA 229.86478 --- # Right Ascension in decimal coordinates specific to the star - obtained from the Hipparcos database (see below), or from "stars.txt" (see below)
Dec -7.7220383 --- # Declination in decimal coordinates specific to the star - obtained from the Hipparcos database (see below), or from "stars.txt" (see below)
Distance 20.446777 --- # Distance in Light Years specific to the star - obtained from the Hipparcos database (see below), or from "stars.txt" (see below)
AppMag 10.56 --- # specific to the star - obtained from the Hipparcos database (see below), or from "stars.txt" (see below)
SpectralType "M3V" --- # specific to the star - obtained from the Hipparcos database (see below), or from "stars.txt" (see below)
Texture "Gliese581.png" --- # the texture name you want to use. Texture must be in the medres folder.
}
5. Save the file in the add-on folder as an ".stc" file, next to the textures folder. Launch Celestia. Your new texture should be displayed on that star. :D

6. To obtain data for the star you are interested in, you can get it several ways, as follows:

a) Download the stars.txt data file that Celestia uses for its stars (most preferred). You can find it at: http://celestia.svn.sourceforge.net/viewvc/*checkout*/celestia/branches/ver1_5_1/celestia/data/stars.txt. Once downloaded and saved, look up your star by HIP #. The data will be listed in the order, HIP #, RA, Dec, Distance, Apparent Magnitude, SpectralType This is the preferred database to use, since this is the data Celestia is using.

b) Alternatively, go to the Hipparcos website at: http://webviz.u-strasbg.fr/viz-bin/VizieR?-source=I/239 and click the button labelled "I/239/hip_main". Type the HIP # or name of the star into the "target" field and submit the query. All the data you need for the STC file will be listed. Note you should use the RA and Dec "decimal" readings for position. The Spectral Type will sometimes be listed as an Spectral letter, or will be listed not as a letter such as O or B or M, but as a number called the "B-V". This number represents a numeric color index used to classify the color of stars. Celestia does not accept B-V numbers. In the STC file, you must convert it to a spectral class letter. To do so, use this H-R Diagram (copy and paste it somewhere convenient):

HR.jpg

For example, a B-V Index of 1.600 would visually be about an M3 - M6 spectral class. There must be a "calculation" to directly convert B-V Indexes to Spectral Class letters (Celestia must use it internally), but I'm not sure how to do it. If anyone does know, please post a reply below. Thanks.

b) A 3rd alternative is to get the spectral class letter directly from the SIMBAD website at: http://simbad.u-strasbg.fr/simbad/sim-fid. You can enter the star HIP # or name in the Identifier field. You can also use this catalog for other stc values. However, before you do, open the "Output Options" tab menu, and change the "Coordinates" field to read "Decimal" instead of "sexagesimal" This will cause the RA and Dec to be displayed in decimal form, which you can use directly. Also note that the SimBad database does not always exactly match the stars database Celestia uses. If they are not a very close match, you may wind up with two stars in that spot, offset a bit from each other. For example, for Gliese 581, stars.txt lists it at RA 229.86478 degrees. Hipparcos lists it the same, as 229.86477439. SIMBAD lists it at 229.86177. In the SIMBAD query results, Magnitude will be listed as Apparent Magnitude under "Fluxes". Choose the "V" value.
Distance is listed as Parallax value. Take that value, and plug it into this formula: Distance = parallax angle from Simbad/1000 * 3.2616341. Use the result in your STC file. SpectralType in SIMBAD is listed directly.


To add a texture to a new fictional star, repeat the steps above, except simply make up values for the 7 lines of code in the stc file. You do not need to fool with catalogs or databases. Just be cautious that you do not place a fictional star on top of an existing star by accident. Choose a HIP number that is larger than say ... 400000.

I hope this has helped. I will try to create a WIKI posting of these instructions ASAP. Thanks again to the others on the forum who gave me help on how to do this.

Regards

Frank
Last edited by fsgregs on 15.07.2008, 03:31, edited 6 times in total.

ajtribick
Developer
Posts: 1855
Joined: 11.08.2003
With us: 21 years 3 months

Re: Tutorial - How to add a new texture to existing or new stars

Post #2by ajtribick » 14.07.2008, 20:51

Some corrections...

fsgregs wrote: a) Download the stars.txt data file that Celestia uses for its stars (most preferred). You can find it at: http://celestia.svn.sourceforge.net/viewvc/*checkout*/celestia/branches/ver1_5_1/celestia/data/stars.txt. Once downloaded and saved, look up your star by HIP #. The data will be listed in the order, HIP #, RA, Dec, Distance, Apparent Magnitude, SpectralType This is the preferred database to use, since this is the exact data Celestia is using.
It is not correct to say that this is the exact data - there seem to be rounding errors involved in the RA, Dec, Distance fields. The correct data is in stars.dat, for which the format is described here, however to parse this file you will need some programming ability.

fsgregs wrote: b) Alternatively, go to the Hipparcos website at: http://webviz.u-strasbg.fr/viz-bin/VizieR-3.
That link does not work. Instead, go to http://webviz.u-strasbg.fr/viz-bin/VizieR?-source=I/239 and click the button labelled "I/239/hip_main".

fsgregs wrote: Type the HIP # or name of the star into the "target" field and submit the query. All the data you need for the STC file will be listed. Note you should use the RA and Dec "decimal" readings for position.
There may be complications here. From investigating the star database generation code, there are actually THREE possible data sources: these are I/239/hip_main, I/239/h_dm_com and I/239/tyc_main.

Positions and parallaxes are taken either from I/239/hip_main or I/239/tyc_main. The choice of parallax depends on which parallax error is smaller. The choice of position is made depending on the sum of the errors in RA and Dec: whichever sum is smaller gets used. (In the case of positions taken from tyc_main where multiple TYC records refer to the same HIP star - i.e. multiple systems, the LAST Tycho record is used, regardless of whether the components of the system in question are the same).

To find the entries in I/239/tyc_main which correspond to a Hipparcos star, go to http://webviz.u-strasbg.fr/viz-bin/VizieR?-source=I/239 and click the button labelled "I/239/tyc_main". You will then need to click the "ALL" button in the "Adapt Form" section to list all the fields in the "Query by constraints applied to columns" section. In the row labelled "HIP", enter the Hipparcos number of the star in question, then click any of the "Submit query" buttons.

In the case that one out of the HIP or TYC records do not contain decimal coordinates, the other record's decimal coordinates will be used.
If both HIP and TYC records do not contain decimal coordinates, the sexagesimal coordinates from HIP are preferred.

fsgregs wrote: The Spectral Type will be listed not as a letter such as O or B or M, but as a number called the "B-V".
Actually, for a large number of stars, Hipparcos does include the spectral type (you'll probably have to scroll down a bit on the HIP record page). Only where this is absent is the B-V color index used to guess the spectral type.

(Note that B-V may be taken from I/239/tyc_main depending on errors)

fsgregs wrote:There must be a "calculation" to directly convert B-V Indexes to Spectral Class letters (Celestia must use it internally), but I'm not sure how to do it. If anyone does know, please post a reply below. Thanks.
There are various tables of typical B-V values for spectral types. It is probably best to use those. The current method for guessing the spectral type from B-V is detailed in lines 417-467 of buildstardb.cpp, this should be fairly human readable, however the scientific justification for it is somewhat dubious.

fsgregs wrote: Distance is listed as Parallax value. Take that value, and plug it into this formula: Distance = parallax angle from Simbad/1000 * 3.2616341. Use the result in your STC file. SpectralType in SIMBAD is listed directly.
Most of the times SIMBAD lists Hipparcos parallax. However, as noted above, occasionally the generation code will use a Tycho-1 parallax. Also in the case that several stars are listed as a multiple system in I/239/h_dm_com then the parallaxes of all components listed in I/239/h_dm_com as belonging to the same multiple system are set to the same value, even when the system is not necessarily physically-associated.

Furthermore you should also check the revised.stc, nearstars.stc, visualbins.stc and spectbins.stc files to make sure the star hasn't been overwritten in one of these files (in which case you can just copy/paste the star from the relevant file).

-----

See how messy this gets? This is why stars.dat is about to be revised (pending discussions on the developers' list to ensure that the result is scientifically justifiable). The revision is going to use the new revision of the Hipparcos catalogue which has recently become available online, which will result in many stars ending up at different coordinates. The use of I/239/h_dm_com and I/239/tyc_main will be discontinued. The generation process will also include a revised B-V to spectral type converter based on data in Kenneth Lang's "Astrophysical Data: Planets and Stars" (1991).

Avatar
Topic author
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Re: Tutorial - How to add a new texture to existing or new stars

Post #3by fsgregs » 14.07.2008, 21:16

Dear ajtribick:

Thanks for all the clarifications. :? I wish texture substitutions on a star were not so complicated, with so many caveats. I used the 1.5.1 stars.txt file, so I assumed the values were as up to date as possible, but ....

Anyway, the procedure should work some of the time??? most of the time??? :roll:

Frank

BobHegwood
Posts: 1803
Joined: 12.10.2007
With us: 17 years 1 month

Re: Tutorial - How to add a new texture to existing or new stars

Post #4by BobHegwood » 15.07.2008, 01:57

Well for what it's worth here...

I, for one, appreciate the effort put into this little tutorial. Thanks a lot for the effort Frank (and some corrections Andrew.)
Much appreciated out here in Brain-Dead land. :wink:
Brain-Dead Geezer Bob is now using...
Windows Vista Home Premium, 64-bit on a
Gateway Pentium Dual-Core CPU E5200, 2.5GHz
7 GB RAM, 500 GB hard disk, Nvidia GeForce 7100
Nvidia nForce 630i, 1680x1050 screen, Latest SVN

Avatar
PlutonianEmpire M
Posts: 1374
Joined: 09.09.2004
Age: 40
With us: 20 years 2 months
Location: MinneSNOWta
Contact:

Re: Tutorial - How to add a new texture to existing or new stars

Post #5by PlutonianEmpire » 15.09.2008, 04:12

Is it possible to edit the radius of an existing star using a similar method to the one outlined above? I ask because celestia sometimes portrays the wrong radius for a particular star.
Terraformed Pluto: Now with New Horizons maps! :D

ajtribick
Developer
Posts: 1855
Joined: 11.08.2003
With us: 21 years 3 months

Re: Tutorial - How to add a new texture to existing or new stars

Post #6by ajtribick » 15.09.2008, 10:29

PlutonianEmpire wrote:Is it possible to edit the radius of an existing star using a similar method to the one outlined above? I ask because celestia sometimes portrays the wrong radius for a particular star.
Yes, there is a Radius property you can use in .stc files, but some things you should bear in mind...

For a start, the tutorial here applies only to the version of stars.dat in v1.5.1, the new version of stars.dat (on the SVN) has a much simpler generation process and has slightly different values for some of the parameters of stars.

Secondly, v1.6.0 (or the latest SVN versions) allow you to use the Modify directive for stars, which will make this tutorial obsolete anyway.

Thirdly, if you are using the v1.5.1 star database, you can use my CHARM2 stellar radii add-on to make Celestia use measured radii for a set of 1944 stars. I am currently modifying it for v1.6.0, see my Celestial Matters blog for more details...

danielj
Posts: 1477
Joined: 15.08.2003
With us: 21 years 3 months

Re: Tutorial - How to add a new texture to existing or new stars

Post #7by danielj » 27.06.2009, 14:33

There was an addon for Regulus and some other star.But an addon for Betelgeuse is missing...Note that we have real images of its surface.The problem is convert the images in a texture.

danielj
Posts: 1477
Joined: 15.08.2003
With us: 21 years 3 months

Re: Tutorial - How to add a new texture to existing or new stars

Post #8by danielj » 08.11.2009, 22:01

No one are going to answer about Betelgeuse?

ushaa4n
Posts: 1
Joined: 02.09.2016
With us: 8 years 2 months

Post #9by ushaa4n » 02.09.2016, 06:17

what do you mean by betelgesus?

Avatar
John Van Vliet
Posts: 2944
Joined: 28.08.2002
With us: 22 years 2 months

Post #10by John Van Vliet » 02.09.2016, 18:19

what do you mean by betelgesus?

the star by that name


Return to “Tutorials”