ENG New site

Advanced search

[ New messages · Forum rules · Members ]
Forum » SpaceEngine » Mods and Addons » MOD - Creating galaxies, nebulae and star clusters 0.980 (How to add your own galaxies)
MOD - Creating galaxies, nebulae and star clusters 0.980
SpaceEngineerDate: Sunday, 17.06.2012, 11:01 | Message # 1
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4800
Status: Offline
Last Updated: 2016/09/20 (version 0.9.8.0)

This manual describes how to add a galaxy, star cluster or nebula to SpaceEngine. Before continue, it is recommended to read these manuals:
SE folders and pak files
Introduction to SE scripts

Galaxies, star clusters and nebulae have a similar format of catalog files. They are stored in a virtual folders */catalogs/galaxies/, */catalogs/clusters/ and */catalogs/nebuale/, respectively. To add a new object, create the sc file in needed subfolder in the addons folder, and type the script in it (see below). You can add multiple object scripts to the sc file.

You can also create a custom 3D model for galaxy or nebula. Otherwise SpaceEngine will use one of the standard model, assigning it to your object based on it's type. You can make a custom model and assign it to a specific galaxy/nebula, or tell SE to assign it procedurally to all galaxies/nebulae which have a certain type (for example, "Sa" galaxies). You can also modify the standard models. Learn how to that here: Creating a model of a galaxy or nebula.

Note: the current version of SpaceEngine does not support procedural generation of galaxies and nebulae, therefore all galaxies/nebulae uses one of the standard models. If you add some new models to the types of galaxies/nebulae, some fraction of these objects in SpaceEngine will use your models.

The majority of galaxies in default SpaceEngine installation are stored in the csv file data/catalogs/Catalogs0980.pak/galaxies/NGC-IC.csv. This is the NGC/IC galaxy catalog with about 10,000 galaxies. Some other galaxies are stored in few sc files in the same system pak file. These default files should not be modified or changed in any way. If you want to update a galaxy, remove it, or add a new one, create your own sc or csv file in the addons/catalogs/galaxies/ folder. SpaceEngine have scripting options to modify and remove objects from the default catalogs, or to add a new ones.

The csv format for catalogs is designed to create a large catalogs of objects with similar data. It is more compact and load faster than sc, but have limited types of data which can be specified in it. It is just a table with values separated by coma. The sc format is designed to specify any possible data what SE can use to describe an object. It is a script-like text with 'tags' used to describe an object and its various parameters. First we'll describe the sc file format.

The galaxy/cluster/nebula catalogs

Galaxies, star clusters and nebulae have very similar format of catalog files. They are differs only by location on the disk, main tag name, and a few parameters specific only for some type of object.

Lets consider you want to create a new galaxy called "MyGalaxy". Go to the addons/catalogs/galaxies/ directory (create it if not exist) and create a new text document there. Rename it to mygalaxy.sc (the file name doesn't matter, but make sure it doesn't match some existing file, otherwise you file will override it). Open it in the notepad and type this code:

Code
Galaxy    "MyGalaxy"
{
    Type    "Sb"  // the Hubble type
    RA       18.365  // right ascension
    Dec     -30.1643    // declination
    Dist     86.67e6    // distance from the Sun
    Radius   21000  // radius
    AbsMagn -21.5  // absolute magnitude
    Quat   ( -0.9269889 0.2641924 0.03661448 0.2637298 )    // orientation quaternion
}


In the galaxy catalog, you can use only these two tags to add a new object or modify the old one:
Galaxy "name" { } - to add/modify a galaxy,
Quasar "name" { } - to add/modify a quasar.
Note what in the current version of SpaceEngine quasars does not differ from the regular galaxies (except designation in the interface).

To add a new galaxy or modify a galaxy which has been already described in the catalogs, simply define a new object (Galaxy or Quasar) with the same name in the galaxy script. SpaceEngine will update the old object with the new data (it's also possible to change its type - from
Galaxy
to Quasar and back).

Star cluster can be added/modified by the same way. Go to the addons/catalogs/clusters/ directory (create it if not exist) and create a new text document there. Rename it to mycluster.sc (the file name doesn't matter). Open it in the notepad and type this code:

Code
Cluster    "MyCluster"
{
    Galaxy  "Milky Way"    // parent galaxy
    Type    "Open"  // type
    RA       5.78333333    // right ascension
    Dec      16.1166667    // declination
    Dist     1230.9  // distance from the Sun
    Radius   4.68  // radius
    AbsMagn -3.6  // absolute magnitude
    CenPow   0.5  // stars concentration parameter
    Age      760  // age
    NStars   1500  // number of stars
    Color   (0.86 0.92 1.00)    // color of the star-like particle
}


And nebula also can be added/modified by the same way. Go to the addons/catalogs/nebulae/ directory (create it if not exist) and create a new text document there. Rename it to mynebula.sc (the file name doesn't matter). Open it in the notepad and type this code:

Code
Nebula    "MyNebula"
{
    Galaxy  "Milky Way"    // parent galaxy
    Type    "Diffuse"    // type
    RA       04 46 18    // right ascension
    Dec     -16 07 36    // declination
    Dist     520.3  // distance from the Sun
    Radius   3.5  // radius
    AppMagn  5   // apparent magnitude
    Quat   ( -0.3156767 -0.6193562 0.2975453 -0.6543798 )    // orientation quaternion
}


You can also remove the previously defined galaxy/quasar/cluster/nebula (i.e. object defined in some older catalog files). Use this parameter in the corresponding sc file (i.e. in the galaxy catalog to remove a galaxy, and so on):
Remove "name" - delete a previously defined object.

The galaxy/cluster/nebula script details

Here we will describe all parameters which can be used in scripts for galaxies, star clusters and nebulae. They are very similar, though some parameters are allowed only for certain type of object. Keep in mind also what you must describe a galaxy in a galaxy catalog, it is not allowed in the nebula or star cluster catalog. And so on for nebulae and star clusters. This is has been noted in the Introduction to SE scripts:

galaxy catalogs */catalogs/galaxies/*.sc can have only Galaxy and Quasar tags;
star cluster catalogs */catalogs/clusters/*.sc can have only Cluster tag;
nebula catalogs */catalogs/nebuale/*.sc can have only Nebula tag.

Parameters, common for all catalogs

RA - right ascension in hours, in decimal format or formatted as HH MM SS.SSS
Dec - declination in degrees, in decimal format or formatted as DD MM SS.SSS
Dist - distance from the Sun in parsecs.
The parameters RA, Dec and Dist can be adjusted in SE in the Edit mode (see below).

Yaw, Pitch, Roll - the Euler angles of orientation of the object, or
Axis - the orientation of the object in the axis-angle format, or
Quat - the orientation quaternion of the object.
The orientation parameters can be adjusted in SE in the Edit mode (see below). If they are not specified, they are generated procedurally.

Lum, Luminosity - luminosity of the object in the units of Sun's luminosity, or
AppMagn - visual (optical) magnitude of the object, or
AbsMagn - absolute (optical) magnitude of the object.

Radius - radius of the object in parsecs.

Type - the morphological type of the object.
In the galaxy catalog it is the Hubble morphological type of a galaxy. Allowed types are:
"E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7" - elliptical galaxies;
"S0" - lenticular galaxies;
"Sa", "Sb", "Sc", "Sd" - spiral galaxies;
"SBa", "SBb", "SBc", "SBd" - barred spiral galaxies;
"Irr" - irregular galaxies.
In the nebula catalog, allowed types are:
"Diffuse" - diffuse nebula;
"Planetary" - planetary nebula;
"SNR" - supernova remnant.
In the star cluster catalog, allowed types are:
"Globular" - globular cluster;
"Open" - open cluster;
"Kern" - the galactic center cluster (special type, used to represent the galaxy center);
"Part" - part of the galaxy (special type with no stars, used to represent a star clouds like M 24 - the Sagittarius Star Cloud).

Parameters, used only in the galaxy catalog

ModelBright - the overall brightness of the galaxy 3D model. Default value is 1.

SolFade true - if specified, generation of procedural objects (stars, star clusters and nebulae) near the Sun will be suppressed. So while looking from the Solar system, there are no visible procedural objects brighter than magnitude 8.1. This is done to prevent change of appearance of real constellations while looking look from the Solar system. The limiting magnitudes for this can be adjusted by the parameters StarMaxAppMagn, ClusterMaxAppMagn and NebulaMaxAppMagn in the config/main-user.cfg file.

Parameters, used only in the star cluster catalog

Galaxy - name of the galaxy to which this star cluster belongs. Example: Galaxy "Milky Way". This galaxy must exist in SE.

Age - age of the star cluster in millions of years. Affects on the generation of procedural stars (more young clusters have more blue stars, more old ones have more red giants).

CenPow - the parameter which defines the amount of "clustering" of stars in the center of the cluster. Larger value (>1) makes more concentrated clusters, lower value (<1) makes more fuzzy clusters.

NStars - number of stars in cluster, allowed only for open clusters. To disable procedural stars, specify zero: NStars 0 (used for Pleiades and other clusters which already have a stars in the star catalog). While generating open cluster model, SpaceEngine sums up the luminosity of generated stars and stops generation when this sum reaches the luminosity of the cluster. So actual number of stars may be lower than specified by NStars.

Color - the RGB vector of the color of particle, which is rendered instead of the cluster model when camera is far away. To disable the particle, set it to black: Color ( 0 0 0 ) (useful for large or very close clusters). If not specified, will be generated procedurally.

Parameters, used only in the nebula catalog

Galaxy - name of the galaxy to which this nebula belongs. Example: Galaxy "Milky Way". This galaxy must exist in SE.

Using the Edit mode

The coordinates, orientation and size of the object can be adjusted in SpaceEngine using the Edit mode. To enter the Edit mode, press the [ * ] button twice. The prompt table will appear in the bottom left of the screen. Using the keystrokes listed in it, you can adjust the parameters of the selected object. The values of RA, Dec, distance, radius and orientation (Axis and Quat) are displayed in the object's information table at the top left side of the screen (don't forgot to switch distance unit to parsecs in the Player settings menu).

To accurately adjust visual position and orientation of the object with respect to real stars (using actual photos from telescopes as reference), do adjusting while looking from the Solar System. Go to the Sun, center the camera view on the object, and use a telescope (Shift + Left mouse drag) to zoom on it.

Note: changes are not saved to the script file. You must type them manually.

The csv format for galaxy catalogs

SpaceEngine supports the csv ("Comma-Separated Values") format for massive stars and galaxies catalogs. It is a plain text format with one galaxy described per line, with values separated with comma. Default SpaceEngine installation have one csv galaxy catalog - data/catalogs/Catalogs0980.pak/galaxies/NGC-IC.csv, which have 10,896 galaxies, and have a size (unpacked) of only 1.3 MB. The csv format is more compact than sc, but have some limitation:
1) Only galaxies can be described, quasars are not allowed.
2) Only these parameters are allowed: Name, Type, RA, Dec, Dist, AbsMagn, Radius, Quat.

The file format is simple: the first line is header describing the names of parameters (separated by comma), the rest lines are galaxies data - values of corresponding parameters (also separated by comma). Here is the example of the first 4 lines of the NGC-IC.csv file:

Code
Name,Type,RA,Dec,Dist,AbsMagn,Radius,Quat.w,Quat.x,Quat.y,Quat.z
NGC 1077-2/NGC 1077B/MCG 7-6-68/ZWG 539.95,SBb,2.76720007,40.093299,171388274,-19.07,12463.208,0.840432,0.534431,0.0164455,0.088246
NGC 1000/MCG 7-6-48/ZWG 539.67/NPM1G +41.78,E0,2.64690011,41.4603005,140145941,-20.13,14269.0703,0.761034,0.552704,-0.274793,-0.199585
IC 275-1/5ZW309,E0,3.01530009,44.3503005,132235717,-18.31,5770.17432,0.760357,0.523453,-0.316721,-0.218042


Note what galaxy name and its Hubble type does not enclosed in quotes. Missing data for some parameters is allowed: just leave these parameters blank, but commas separated them are still necessary (like this: ,,).

The csv catalogs have a priority over sc catalogs, i.e. they are loaded first. But then star solver takes the file/pak modification date to perform star data merging or updating. The config-file parameter CsvLogLevel in the config/main-user.cfg file controls the star solver's logging level for all the csv files.
 
SpaceEngineerDate: Sunday, 17.06.2012, 11:07 | Message # 2
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4800
Status: Offline
This tutorial will be changed a bit soon, after 0.96 release. If you want to make some galaxy models, make sure you don't try to make one of these galaxies, because they are already made and will be included in 0.96:

Milky Way
LMC
SMC
Hoag's object
IC 342
M 31
M 33
M 51
M 74
M 81
M 83
M 101
M 104
NGC 1232
NGC 1300
NGC 1309
NGC 1365
NGC 1672
NGC 2442
NGC 3982
NGC 6217
NGC 6744
NGC 6946
NGC 7674





 
HarbingerDawnDate: Sunday, 17.06.2012, 13:30 | Message # 3
Cosmic Curator
Group: Administrators
United States
Messages: 8717
Status: Offline
Quote (SpaceEngineer)
Milky Way

Is this going to be a NEW Milky Way model!?

P.S. I'm glad that this tutorial is finally posted in the English forum biggrin





All forum users, please read this!
My SE mods and addons
Phenom II X6 1090T 3.2 GHz, 16 GB DDR3 RAM, GTX 970 3584 MB VRAM
 
SpaceEngineerDate: Sunday, 17.06.2012, 13:58 | Message # 4
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4800
Status: Offline
Quote (HarbingerDawn)
Is this going to be a NEW Milky Way model!?

All models are changed a bit, but not noticeably.

*





 
DoctorOfSpaceDate: Sunday, 17.06.2012, 20:24 | Message # 5
Galaxy Architect
Group: Global Moderators
Pirate
Messages: 3600
Status: Offline
I made a galaxy a couple weeks ago using trial and error and got it semi working. Really nice to see a tutorial on how to do it, should help me finish what I was doing.




Intel Core i7-5820K 4.2GHz 6-Core Processor
G.Skill Ripjaws V Series 32GB (4 x 8GB) DDR4-2400 Memory
EVGA GTX 980 Ti SC 6GB
 
KvikiDate: Sunday, 29.07.2012, 00:20 | Message # 6
Explorer
Group: SE team
Croatia
Messages: 289
Status: Offline
I'm confused. After many hours I finally made the galaxy and the sys image sucessfuly, here's what they look like:
http://dl.dropbox.com/u/43860080/galaxika.png
http://dl.dropbox.com/u/43860080/sys.jpg

After looking at other galaxies in the textures/galaxies folder, I noticed none of them had the actual colored-galaxy look, only the dust texture. So I took the dust out of the main colored texture, saved it as png and replaced the milky way texture with it just to see what it'd look like. The dust was there, but there were no colors, or anything of the main texture. It seems I don't understand how to add the dust into the frontal texture's alpha channel.

Then I tried it another way. I took the colored texture I made and saved it as tga and replaced the milky way once again, tested it in SE and it looked perfect, however there were no dust sprites that are seen when galaxies overlap.

EDIT: About this, I figured the problem is I do not know how to make an alpha channel! It will probably look good once I get the hang of it, never had to use alpha channel til now. biggrin

Another issue with the png-tga files. When I save the textures in png rectangles appear around the galaxy texture in SE. When I save as tga and run it in spaceengine it looks properly, isn't spaceengine supposed to create fixed pngs from the tga textures? SE only makes empty png textures from the tga textures (there's nothing on the newly created png).

Aaand another thing, on galaxies that were already made, when I swap the textures the galaxy's center won't change. It has the same pattern as the original texture of that galaxy. So if I swapped my own texture with the milky way's, the milky way's center would be the same as before. Where is this stored/how do you remove it?







Edited by Kviki - Sunday, 29.07.2012, 00:50
 
HarbingerDawnDate: Sunday, 29.07.2012, 00:44 | Message # 7
Cosmic Curator
Group: Administrators
United States
Messages: 8717
Status: Offline
Your links are empty...

The way I add the dust to the alpha channel is via a layer mask; I paste the dust into the mask and that's all. I don't know how to do this in Photoshop; I prefer GIMP for this sort of work, it really is much easier to work with masks in it.
There's probably a much easier way to add the dust image as the alpha channel, especially in Photoshop, but I don't know how as I am pretty unfamiliar with PS.

If you're using Photoshop, save as TGA. If you use GIMP you can save a PNG without any problems. You could also use another program to convert your TGA to PNG if SE doesn't do it for you properly. But since SpaceEngine can use the TGA without any problems, I don't see why you would really need to convert (unless you are extremely limited in memory or disk space).

When you change the galaxy texture, you must delete the model from the cache folder, otherwise the new model will not be implemented properly.





All forum users, please read this!
My SE mods and addons
Phenom II X6 1090T 3.2 GHz, 16 GB DDR3 RAM, GTX 970 3584 MB VRAM
 
KvikiDate: Sunday, 29.07.2012, 00:54 | Message # 8
Explorer
Group: SE team
Croatia
Messages: 289
Status: Offline
Thank you once again smile
The links should be fixed now (darn dropbox!)

Well, the main thing why I want it in .png is because if I want to make the galaxy as a mod, everyone who wants to use it would have to go to main.cfg and check the setting.

I'll have to see some tutorials about the alpha channel tomorrow (today) to learn how to do it properly.

EDIT:
Quote (kviki)
everyone who wants to use it would have to go to main.cfg and check the setting.

Quote (harbringerdawn)
Why? I've never had to change any settings to use a galaxy model with a TGA texture.


Woops, I guess I didn't think about it. Forgot that the option was for converting the tga textures to png, not to enable tga textures. tongue

Know about stash, unfortunately I'm too lazy to go to deviantart!







Edited by Kviki - Sunday, 29.07.2012, 01:08
 
HarbingerDawnDate: Sunday, 29.07.2012, 01:01 | Message # 9
Cosmic Curator
Group: Administrators
United States
Messages: 8717
Status: Offline
Quote (Kviki)
everyone who wants to use it would have to go to main.cfg and check the setting.

Why? I've never had to change any settings to use a galaxy model with a TGA texture.

Quote (Kviki)
(darn dropbox!)

I know how you feel... I don't use Dropbox anymore. I would suggest creating a DeviantArt account, they have a feature called Stash (or Sta.sh) that functions like Dropbox, only it's easier to use, more functional, and has no strings attached (i.e. no software to install, so special folders on your computer, etc). It also has the same 2 GB limit. Every file I post to the site now is hosted there.





All forum users, please read this!
My SE mods and addons
Phenom II X6 1090T 3.2 GHz, 16 GB DDR3 RAM, GTX 970 3584 MB VRAM
 
KvikiDate: Sunday, 29.07.2012, 02:04 | Message # 10
Explorer
Group: SE team
Croatia
Messages: 289
Status: Offline
Well, another problem. I barely get any dust sprites in my galaxy when using the textures posted in 2 posts earlier. In what lies the problem? There's also an adittional 128x128 texture of the colored galaxy texture (only reduced its size).






Edited by Kviki - Sunday, 29.07.2012, 02:06
 
SpaceEngineerDate: Sunday, 29.07.2012, 02:16 | Message # 11
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4800
Status: Offline
First, why your system texture is shifted relative to front (color) texture?
Second, colors of this galaxy looks unnatural. Is it false-color or infrared image?
Third, dust should be in the alpha channel of front texture.
To convert tga to png, I add a console command in SE:

SavePNG data/textures/galaxies/yourtexture.png

You may simply copy/paste this code to SE console and change the name of the texture file. Console is called by ~ key.





 
KvikiDate: Sunday, 29.07.2012, 02:38 | Message # 12
Explorer
Group: SE team
Croatia
Messages: 289
Status: Offline
Quote (SpaceEngineer)
First, why your system texture is shifted relative to front (color) texture?

I dont understand what you mean

Quote (SpaceEngineer)
Second, colors of this galaxy looks unnatural. Is it false-color or infrared image?

I changed the saturation biggrin it's easily changed to appear more real

Quote (SpaceEngineer)
Third, dust should be in the alpha channel of front texture.

Yes, i'll need to learn more about alpha channel today (never used it)

Quote (SpaceEngineer)
To convert tga to png, I add a console command in SE:

SavePNG data/textures/galaxies/yourtexture.png

It worked flawlessly, thanks!

___________
Can you perhaps tell me why there are barely any dust sprites in my galaxy? (link to the post)





 
HarbingerDawnDate: Sunday, 29.07.2012, 03:10 | Message # 13
Cosmic Curator
Group: Administrators
United States
Messages: 8717
Status: Offline
Quote (Kviki)
I dont understand what you mean

In the images you linked, the features in the two images are offset from each other (the pixels do not line up if overlayed).

Quote (Kviki)
Can you perhaps tell me why there are barely any dust sprites in my galaxy?

The density and distribution of the dust is determined by the alpha channel (transparency) of the texture. More opaque equals more dust.





All forum users, please read this!
My SE mods and addons
Phenom II X6 1090T 3.2 GHz, 16 GB DDR3 RAM, GTX 970 3584 MB VRAM
 
KvikiDate: Sunday, 29.07.2012, 12:59 | Message # 14
Explorer
Group: SE team
Croatia
Messages: 289
Status: Offline
I've fixed the textures' positions now.
Regarding the dust sprites: the texture is on a black background, so it can't be more opaque.
The only sucessful thing so far was the sys texture.
Also, when looking at the galaxy from the side view, there are dust sprites but they're all black (even though the actual texture isn't empty/black there).

I also tried adding the dust texture to the colored texture's alpha channel. It becomes all red.

This is all so confusing sad





 
HarbingerDawnDate: Sunday, 29.07.2012, 14:21 | Message # 15
Cosmic Curator
Group: Administrators
United States
Messages: 8717
Status: Offline
Send me your files and I'll try to get them to work. If I can, then I will create a step-by-step tutorial for you.




All forum users, please read this!
My SE mods and addons
Phenom II X6 1090T 3.2 GHz, 16 GB DDR3 RAM, GTX 970 3584 MB VRAM
 
Forum » SpaceEngine » Mods and Addons » MOD - Creating galaxies, nebulae and star clusters 0.980 (How to add your own galaxies)
Search: