{"id":631,"date":"2016-10-30T20:23:46","date_gmt":"2016-10-30T20:23:46","guid":{"rendered":"http:\/\/spaceengine.org\/?page_id=631"},"modified":"2018-11-03T11:48:43","modified_gmt":"2018-11-03T11:48:43","slug":"creating-a-dso","status":"publish","type":"page","link":"https:\/\/spaceengine.org\/manual\/making-addons\/creating-a-dso\/","title":{"rendered":"Creating a DSO"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row row_type=\"row\" use_row_as_full_screen_section=\"no\" type=\"full_width\" text_align=\"left\" box_shadow_on_row=\"no\"][vc_column][no_accordion active_tab=\"1\" background_transparency=\"no\" style=\"boxed_accordion\"][no_accordion_section title=\"Creating a deep space object\" accordion_type=\"accordion_icon\" icon_pack=\"font_elegant\" fe_icon=\"icon_cog\"][vc_column_text]This manual describes how to add a galaxy, star cluster or nebula to SpaceEngine. Before continuing, it is recommended that you read this manual: <a class=\"link\" href=\"http:\/\/spaceengine.org\/manual\/making-addons\/introduction\/\" target=\"_blank\" rel=\"nofollow\">Introduction<\/a>.<\/p>\n<p>Galaxies, star clusters and nebulae have a similar format of catalog file. They are stored in the virtual folders <span class=\"se_path\">*\/catalogs\/galaxies\/<\/span>, <span class=\"se_path\">*\/catalogs\/clusters\/<\/span> and <span class=\"se_path\">*\/catalogs\/nebuale\/<\/span>, respectively. To add a new object, create the sc file in the needed subfolder in the <span class=\"se_path\">addons<\/span> folder, and type the script in it (see below). You can add multiple object scripts to the sc file.<\/p>\n<p>You can also create a custom 3D model for galaxy or nebula. Otherwise SpaceEngine will use one of the standard models, assigning it to your object based on its 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.<\/p>\n<p><span class=\"se_warn\">Note:<\/span> 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 new models to the types of galaxies\/nebulae, some fraction of these objects in SpaceEngine will use your models.<\/p>\n<p>The majority of galaxies in the default SpaceEngine installation are stored in the csv file <span class=\"se_path\">data\/catalogs\/<\/span><span class=\"se_pak\">Catalogs0980.pak\/galaxies\/NGC-IC.csv<\/span>. 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 <span class=\"se_path\">addons\/catalogs\/galaxies\/<\/span> folder. SpaceEngine has scripting options to modify and remove objects from the default catalogs, or to add new ones.<\/p>\n<p>The csv format for a catalogs is designed to create a large list of objects with similar data. It is more compact and loads faster than sc, but has limits to the types of data which can be specified in it. It is just a table with values separated by commas. The sc format is designed to specify any possible data that 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.<\/p>\n<h4 class=\"se_h4\">The galaxy\/cluster\/nebula catalogs<\/h4>\n<p>Galaxies, star clusters and nebulae have very of catalog file formats. They differ only by location on the disk, main tag name, and a few parameters specific for only some types of object.<\/p>\n<p>Let's consider you want to create a new galaxy called \"MyGalaxy\". Go to the <span class=\"se_path\">addons\/catalogs\/galaxies\/<\/span> directory (create it if it does not exist) and create a new text document there. Rename it to <span class=\"se_path\">mygalaxy.sc<\/span> (the file name doesn't matter, but make sure it doesn't match some existing file, otherwise your file <a class=\"link\" href=\"http:\/\/spaceengine.org\/manual\/making-addons\/introduction\/\" target=\"_blank\" rel=\"nofollow\">will override<\/a> it). Open it in Notepad and type this code:<\/p>\n<p><!--uzcode--><\/p>\n<div class=\"bbCodeBlock\">\n<div class=\"bbCodeName\" style=\"padding-left: 5px; font-weight: bold; font-size: 7pt;\">Code<\/div>\n<div class=\"se_code\" style=\"border: 1px inset; max-height: 200px; overflow: auto; height: 200px;\"><!--uzc--><br \/>\nGalaxy \"MyGalaxy\"<br \/>\n{<\/p>\n<p class=\"codepaddingleft\">\nType\u00a0\u00a0\u00a0\u00a0\"Sb\"\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ the Hubble type<br \/>\nRA\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a018.365\u00a0\u00a0\/\/ right ascension<br \/>\nDec\u00a0\u00a0\u00a0\u00a0\u00a0-30.1643\u00a0\/\/ declination<br \/>\nDist\u00a0\u00a0\u00a0\u00a0\u00a086.67e6\u00a0\/\/ distance from the Sun<br \/>\nRadius\u00a0\u00a0\u00a021000\u00a0\u00a0\u00a0\/\/ radius<br \/>\nAbsMagn\u00a0-21.5\u00a0\u00a0\u00a0\u00a0\/\/ absolute magnitude<br \/>\nQuat\u00a0\u00a0\u00a0\u00a0( -0.9269889 0.2641924 0.03661448 0.2637298 )\u00a0\u00a0\/\/ orientation quaternion\n<\/p>\n<p>}<!--\/uzc--><\/div>\n<\/div>\n<p><!--\/uzcode--><\/p>\n<p>In the galaxy catalog, you can use only these two tags to add a new object or modify the old one:<br \/>\n<span class=\"se_script\">Galaxy \"name\" { }<\/span> - to add\/modify a galaxy,<br \/>\n<span class=\"se_script\">Quasar \"name\" { }<\/span> - to add\/modify a quasar.<br \/>\nNote that in the current version of SpaceEngine quasars do not differ from regular galaxies (except designation in the interface).<\/p>\n<p>To add a new galaxy or modify a galaxy which has already been described in the catalogs, simply define a new object (<span class=\"se_script\">Galaxy<\/span> or <span class=\"se_script\">Quasar<\/span>) 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 <span class=\"se_script\"><br \/>\nGalaxy<\/span> to <span class=\"se_script\">Quasar<\/span> and back).<\/p>\n<p>Star clusters can be added\/modified by the same way. Go to the <span class=\"se_path\">addons\/catalogs\/clusters\/<\/span> directory (create it if it does not exist) and create a new text document there. Rename it to <span class=\"se_path\">mycluster.sc<\/span> (the file name doesn't matter). Open it in Notepad and type this code:<\/p>\n<p><!--uzcode--><\/p>\n<div class=\"bbCodeBlock\">\n<div class=\"bbCodeName\" style=\"padding-left: 5px; font-weight: bold; font-size: 7pt;\">Code<\/div>\n<div class=\"se_code\" style=\"border: 1px inset; max-height: 200px; overflow: auto; height: 200px;\"><!--uzc--><br \/>\nCluster \"MyCluster\"<br \/>\n{<\/p>\n<p class=\"codepaddingleft\">Galaxy\u00a0\u00a0\"Milky Way\"\u00a0\/\/ parent galaxy<br \/>\nType\u00a0\u00a0\u00a0\u00a0\"Open\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ type<br \/>\nRA\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a05.78333333\u00a0\/\/ right ascension<br \/>\nDec\u00a0\u00a0\u00a0\u00a0\u00a0\u00a016.1166667\u00a0\/\/ declination<br \/>\nDist\u00a0\u00a0\u00a0\u00a0\u00a01230.9\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ distance from the Sun<br \/>\nRadius\u00a0\u00a0\u00a04.68\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ radius<br \/>\nAbsMagn\u00a0-3.6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ absolute magnitude<br \/>\nCenPow\u00a0\u00a0\u00a00.5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ star concentration parameter<br \/>\nAge\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0760\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ age<br \/>\nNStars\u00a0\u00a0\u00a01500\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ number of stars<br \/>\nColor\u00a0\u00a0\u00a0(0.86 0.92 1.00)\u00a0\u00a0\/\/ color of the star-like particle<\/p>\n<p>}<!--\/uzc--><\/p>\n<\/div>\n<\/div>\n<p><!--\/uzcode--><\/p>\n<p>And nebulas can also be added\/modified by the same way. Go to the <span class=\"se_path\">addons\/catalogs\/nebulae\/<\/span> directory (create it if it does not exist) and create a new text document there. Rename it to <span class=\"se_path\">mynebula.sc<\/span> (the file name doesn't matter). Open it in Notepad and type this code:<\/p>\n<p><!--uzcode--><\/p>\n<div class=\"bbCodeBlock\">\n<div class=\"bbCodeName\" style=\"padding-left: 5px; font-weight: bold; font-size: 7pt;\">Code<\/div>\n<div class=\"se_code\" style=\"border: 1px inset; max-height: 200px; overflow: auto; height: 200px;\"><!--uzc--><br \/>\nNebula \"MyNebula\"<br \/>\n{<\/p>\n<p class=\"codepaddingleft\">\nGalaxy\u00a0\u00a0\"Milky Way\"\u00a0\/\/ parent galaxy<br \/>\nType\u00a0\u00a0\u00a0\u00a0\"Diffuse\"\u00a0\u00a0\u00a0\/\/ type<br \/>\nRA\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a004 46 18\u00a0\u00a0\u00a0\/\/ right ascension<br \/>\nDec\u00a0\u00a0\u00a0\u00a0\u00a0-16 07 36\u00a0\u00a0\u00a0\/\/ declination<br \/>\nDist\u00a0\u00a0\u00a0\u00a0\u00a0520.3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ distance from the Sun<br \/>\nRadius\u00a0\u00a0\u00a03.5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ radius<br \/>\nAppMagn\u00a0\u00a05\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ apparent magnitude<br \/>\nQuat\u00a0\u00a0\u00a0\u00a0( -0.3156767 -0.6193562 0.2975453 -0.6543798 )\u00a0\u00a0\/\/ orientation quaternion\n<\/p>\n<p>}<br \/>\n<!--\/uzc--><\/div>\n<\/div>\n<p><!--\/uzcode--><\/p>\n<p>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):<br \/>\n<span class=\"se_script\">Remove \"name\"<\/span> - delete a previously defined object.<\/p>\n<h4 class=\"se_h4\">The galaxy\/cluster\/nebula script details<\/h4>\n<p>Here we will describe all the 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 types of object. Also keep in mind that you must describe a galaxy in a galaxy catalog, it is not allowed in the nebula or star cluster catalog. And so on for nebulas and star clusters. This has been noted in the <a class=\"link\" href=\"http:\/\/spaceengine.org\/manual\/making-addons\/introduction\/\" target=\"_blank\" rel=\"nofollow\">Introduction to SE scripts<\/a>:<\/p>\n<p>Galaxy catalogs <span class=\"se_path\">*\/catalogs\/galaxies\/*.sc<\/span> can have only <span class=\"se_script\">Galaxy<\/span> and <span class=\"se_script\">Quasar<\/span> tags;<br \/>\nStar cluster catalogs <span class=\"se_path\">*\/catalogs\/clusters\/*.sc<\/span> can have only <span class=\"se_script\">Cluster<\/span> tags;<br \/>\nNebula catalogs <span class=\"se_path\">*\/catalogs\/nebuale\/*.sc<\/span> can have only <span class=\"se_script\">Nebula<\/span> tags.<\/p>\n<h5 class=\"se_h5\">Parameters, common for all catalogs<\/h5>\n<p><span class=\"se_script\">RA<\/span> - right ascension in hours, in decimal format or formatted as HH MM SS.SSS<br \/>\n<span class=\"se_script\">Dec<\/span> - declination in degrees, in decimal format or formatted as DD MM SS.SSS<br \/>\n<span class=\"se_script\">Dist<\/span> - distance from the Sun in parsecs.<br \/>\nThe parameters <span class=\"se_script\">RA, Dec<\/span> and <span class=\"se_script\">Dist<\/span> can be adjusted in SE in the Edit mode (see below).<\/p>\n<p><span class=\"se_script\">Yaw, Pitch, Roll<\/span> - the Euler angles of orientation of the object, or<br \/>\n<span class=\"se_script\">Axis<\/span> - the orientation of the object in the axis-angle format, or<br \/>\n<span class=\"se_script\">Quat<\/span> - the orientation quaternion of the object.<br \/>\nThe orientation parameters can be adjusted in SE in Edit mode (see below). If they are not specified, they are generated procedurally.<\/p>\n<p><span class=\"se_script\">Lum, Luminosity<\/span> - luminosity of the object in units of Sun's luminosity, or<br \/>\n<span class=\"se_script\">AppMagn<\/span> - apparent (optical) magnitude of the object, or<br \/>\n<span class=\"se_script\">AbsMagn<\/span> - absolute (optical) magnitude of the object.<\/p>\n<p><span class=\"se_script\">Radius<\/span> - radius of the object in parsecs.<\/p>\n<p><span class=\"se_script\">Type<\/span> - the morphological type of the object.<br \/>\nIn the galaxy catalog it is the <a class=\"link\" href=\"https:\/\/en.wikipedia.org\/wiki\/Hubble_sequence\" target=\"_blank\" rel=\"nofollow\">Hubble morphological type<\/a> of a galaxy. Allowed types are:<br \/>\n<span class=\"se_script\">\"E0\", \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\", \"E7\"<\/span> - elliptical galaxies;<br \/>\n<span class=\"se_script\">\"S0\"<\/span> - lenticular galaxies;<br \/>\n<span class=\"se_script\">\"Sa\", \"Sb\", \"Sc\", \"Sd\"<\/span> - spiral galaxies;<br \/>\n<span class=\"se_script\">\"SBa\", \"SBb\", \"SBc\", \"SBd\"<\/span> - barred spiral galaxies;<br \/>\n<span class=\"se_script\">\"Irr\"<\/span> - irregular galaxies.<br \/>\nIn the nebula catalog, allowed types are:<br \/>\n<span class=\"se_script\">\"Diffuse\"<\/span> - diffuse nebula;<br \/>\n<span class=\"se_script\">\"Planetary\"<\/span> - planetary nebula;<br \/>\n<span class=\"se_script\">\"SNR\"<\/span> - supernova remnant.<br \/>\nIn the star cluster catalog, allowed types are:<br \/>\n<span class=\"se_script\">\"Globular\"<\/span> - globular cluster;<br \/>\n<span class=\"se_script\">\"Open\"<\/span> - open cluster;<br \/>\n<span class=\"se_script\">\"Kern\"<\/span> - the galactic center cluster (special type, used to represent the galaxy center);<br \/>\n<span class=\"se_script\">\"Part\"<\/span> - part of the galaxy (special type with no stars, used to represent a star clouds like M 24 - the Sagittarius Star Cloud).<\/p>\n<h5 class=\"se_h5\">Parameters, used only in the galaxy catalog<\/h5>\n<p><span class=\"se_script\">ModelBright<\/span> - the overall brightness of the galaxy 3D model. Default value is 1.<\/p>\n<p><span class=\"se_script\">SolFade true<\/span> - 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 <span class=\"se_script\">StarMaxAppMagn<\/span>, <span class=\"se_script\">ClusterMaxAppMagn<\/span> and <span class=\"se_script\">NebulaMaxAppMagn<\/span> in the <span class=\"se_path\">config\/main-user.cfg<\/span> file.<\/p>\n<h5 class=\"se_h5\">Parameters, used only in the star cluster catalog<\/h5>\n<p><span class=\"se_script\">Galaxy<\/span> - name of the galaxy to which this star cluster belongs. Example: <span class=\"se_script\">Galaxy \"Milky Way\"<\/span>. This galaxy must exist in SE.<\/p>\n<p><span class=\"se_script\">Age<\/span> - age of the star cluster in millions of years. Affects the generation of procedural stars (younger clusters have more blue stars, older ones have more red giants).<\/p>\n<p><span class=\"se_script\">CenPow<\/span> - the parameter which defines the amount of \"clustering\" of stars in the center of the cluster. Larger value (&gt;1) makes more concentrated clusters, lower value (&lt;1) makes more fuzzy clusters.<\/p>\n<p><span class=\"se_script\">NStars<\/span> - number of stars in cluster, allowed only for open clusters. To disable procedural stars, specify zero: <span class=\"se_script\">NStars 0<\/span> (used for Pleiades and other clusters which already have a stars in the star catalog). While generating an open cluster model, SpaceEngine sums up the luminosity of generated stars and stops generation when this sum reaches the luminosity of the cluster. So the actual number of stars may be lower than specified by <span class=\"se_script\">NStars<\/span>.<\/p>\n<p><span class=\"se_script\">Color<\/span> - the RGB vector of the color of the particle that is rendered instead of the cluster model when camera is far away. To disable this particle, set it to black: <span class=\"se_script\">Color ( 0 0 0 )<\/span> (useful for large or very close clusters). If not specified, will be generated procedurally.<\/p>\n<h5 class=\"se_h5\">Parameters, used only in the nebula catalog<\/h5>\n<p><span class=\"se_script\">Galaxy<\/span> - name of the galaxy to which this nebula belongs. Example: <span class=\"se_script\">Galaxy \"Milky Way\"<\/span>. This galaxy must exist in SE.<\/p>\n<h4 class=\"se_h4\">Using the Edit mode<\/h4>\n<p>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).<\/p>\n<p>To accurately adjust the visual position and orientation of the object with respect to real stars (using actual photos from telescopes as reference), do the 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 in on it.<\/p>\n<p><span class=\"se_warn\">Note: changes are not saved to the script file<\/span>. You must type them manually.<\/p>\n<h4 class=\"se_h4\">The csv format for a galaxy catalog<\/h4>\n<p>SpaceEngine supports the csv (\"Comma-Separated Values\") format for massive star and galaxy catalogs. It is a plain text format with one galaxy described per line, with values separated with commas. The default SpaceEngine installation has one csv galaxy catalog - <span class=\"se_path\">data\/catalogs\/<\/span><span class=\"se_pak\">Catalogs0980.pak\/galaxies\/NGC-IC.csv<\/span>, which has 10,896 galaxies, and a size (unpacked) of only 1.3 MB. The csv format is more compact than sc, but has some limitations:<br \/>\n1) Only galaxies can be described, quasars are not allowed.<br \/>\n2) Only these parameters are allowed: Name, Type, RA, Dec, Dist, AbsMagn, Radius, Quat.<\/p>\n<p>The file format is simple: the first line is a header with the names of the parameters (separated by commas), the remaining lines are galaxies with their data - values of corresponding parameters (also separated by commas). Here is an example of the first 4 lines of the <span class=\"se_path\">NGC-IC.csv<\/span> file:<\/p>\n<p><!--uzcode--><\/p>\n<div class=\"bbCodeBlock\">\n<div class=\"bbCodeName\" style=\"padding-left: 5px; font-weight: bold; font-size: 7pt;\">Code<\/div>\n<div class=\"se_code\" style=\"border: 1px inset; max-height: 200px; overflow: auto;\"><!--uzc-->Name,Type,RA,Dec,Dist,AbsMagn,Radius,Quat.w,Quat.x,Quat.y,Quat.z<br \/>\nNGC 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<br \/>\nNGC 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<br \/>\nIC 275-1\/5ZW309,E0,3.01530009,44.3503005,132235717,-18.31,5770.17432,0.760357,0.523453,-0.316721,-0.218042<!--\/uzc--><\/div>\n<\/div>\n<p><!--\/uzcode--><\/p>\n<p>Note that the galaxy name and its Hubble type are not enclosed in quotes. Missing data for some parameters is allowed: just leave these parameters blank, but commas separating them is still necessary (like this: ,,).<\/p>\n<p>The csv catalogs have a priority over sc catalogs, i.e. they are loaded first. But then the star solver takes the file\/pak modification date to perform star data merging or updating. The config-file parameter <span class=\"se_script\">CsvLogLevel<\/span> in the <span class=\"se_path\">config\/main-user.cfg<\/span> file controls the star solver's logging level for all the csv files.<\/p>\n<h4 class=\"se_h4\">Creating a custom 3D model for a galaxy or nebula<\/h4>\n<p>The current version of SpaceEngine (0.9.8.0) uses sprites to render 3D models of galaxies and nebulae. They are very similar in format, thus their scripts are also very similar. There are many methods of creating models in SE, but they are all focussed on creating a 3D distribution of sprites with various sizes and colors. The user can control its shape and color by providing textures (image files) and specifying how to use them to create a 3D sprite model. Spiral galaxies can also use high-resolution disk textures to enhance the rendering quality when the galaxy is observed from the top. The methods provided by SE are:<\/p>\n<ul class=\"manlist\">\n<li>Elliptical galaxies: use a special ray-tracing shader, so they do not need 3D models.<\/li>\n<li>Spiral and lenticular galaxies: the \"galaxy\" method. Require a high-resolution RGBA texture of the disk with dust patterns in the alpha channel, it's reduced version (128x128), and a high-resolution RGB texture which maps the distribution of blue stars, open star clusters and nebulae in the disk.<\/li>\n<li>Irregular galaxies and nebulae: various texture projection methods. Require one to six RGBA textures, which represents view of the model from different sides (front, top, left and so on). Various applying methods are possible (cubic, cylindrical etc). Used to simulate real shapes of irregular galaxies and any type of nebula.<\/li>\n<li>Irregular galaxies and nebulae: fully procedural fractal-based generation of a sprite distribution. Used for procedural irregular galaxy and any type of nebula.<\/li>\n<\/ul>\n<p>To describe a galaxy\/nebula model, we need these frontal\/projection textures, and a model script. Textures for galaxies are stored in the virtual folder <span class=\"se_path\">*\/textures\/galaxies\/<\/span>, and for nebulae in the <span class=\"se_path\">*\/textures\/nebulae\/<\/span>. The model script is a file with extension <span class=\"se_path\">*.cfg<\/span>, located in the <span class=\"se_path\">*\/models\/galaxies\/<\/span> or <span class=\"se_path\">*\/models\/nebulae\/<\/span> for galaxies and nebulae, respectively.<\/p>\n<p>To add a new galaxy model, go to the <span class=\"se_path\">addons\/models\/galaxies\/<\/span> folder and create a new text document there. Rename it to <span class=\"se_path\">mymodel.sc<\/span> (the file name doesn't matter, but make sure it doesn't match some existing file, otherwise your file <a class=\"link\" href=\"http:\/\/spaceengine.org\/manual\/making-addons\/introduction\/\" target=\"_blank\" rel=\"nofollow\">will override<\/a> it). Open it in Notepad and type this code:<\/p>\n<p><!--uzcode--><\/p>\n<div class=\"bbCodeBlock\">\n<div class=\"bbCodeName\" style=\"padding-left: 5px; font-weight: bold; font-size: 7pt;\">Code<\/div>\n<div class=\"se_code\" style=\"border: 1px inset; max-height: 200px; overflow: auto;\"><!--uzc--><br \/>\nGalaxyModel \"MyGalaxyModel\"<br \/>\n{<\/p>\n<div class=\"codepaddingleft\">\nUseForObject\u00a0\"MyGalaxy\"\u00a0\u00a0\u00a0\u00a0\/\/ name of the galaxy for which this model must be used<br \/>\nUseForType\u00a0\u00a0\u00a0\"Sb\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ type of galaxies for which this model must be used\u00a0\u00a0\u00a0\u00a0<br \/>\nMethod\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"SpiralGalaxy\"\u00a0\/\/ method of shape generation<br \/>\nPosition\u00a0\u00a0\u00a0\u00a0(0 0 0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ offset of the sprite model<br \/>\nRadius\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(1.0 0.2 0.1)\u00a0\u00a0\/\/ disk radius, bulge radius, bulge thickness<br \/>\nBulgeRadius\u00a0(1 1 1)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ size of the bulge<br \/>\nBBoxRes\u00a0\u00a0\u00a0\u00a0\u00a0(8 8 8)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ resolution of the octree for spritesfloatLOD\u00a0\u00a0\u00a0\u00a00\u00a0\/\/ whether or not to use continuous LOD (0 = false)<br \/>\nLODbase\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\/\/ LOD base\/\/ paths to textures<br \/>\nFrontTexture\u00a0\"MyGalaxy.*\"<br \/>\nSysTexture\u00a0\u00a0\u00a0\"MyGalaxy\u00a0sys.*\"<br \/>\nFrontImage\u00a0\u00a0\u00a0\"MyGalaxy\u00a0small.*\"<br \/>\nSideImage\u00a0\u00a0\u00a0\u00a0\"Sa\u00a0side.*\"<\/p>\n<p>\/\/ resolution of the model (number of sprites multiplier)<br \/>\n\/\/ in radial and Z directions, respectively for<br \/>\n\/\/ emission, absorption and bulge sprites<br \/>\nemDetailR\u00a0\u00a0\u00a01.0<br \/>\nemDetailZ\u00a0\u00a0\u00a00.75<br \/>\nabsDetailR\u00a0\u00a02.0<br \/>\nabsDetailZ\u00a0\u00a00.5<br \/>\nbDetailR\u00a0\u00a0\u00a0\u00a00.75<br \/>\nbDetailZ\u00a0\u00a0\u00a0\u00a00.75<\/p>\n<p>\/\/ colors of the emission, absorption and bulge sprites<br \/>\nemParticleColor\u00a0\u00a0(1.0 1.0 1.0)<br \/>\nabsParticleColor\u00a0(0.0 0.3 0.5)<br \/>\nbParticleColor\u00a0\u00a0\u00a0(1.0 0.9 0.7)<\/p>\n<p>\/\/ displacement of the emission, absorption and bulge sprites<br \/>\nemParticleDispR\u00a0\u00a00.25<br \/>\nemParticleDispZ\u00a0\u00a00.25<br \/>\nabsParticleDispR\u00a00.25<br \/>\nabsParticleDispZ\u00a00.5<br \/>\nbParticleDispR\u00a0\u00a0\u00a00.2<br \/>\nbParticleDispZ\u00a0\u00a0\u00a00.2<\/p>\n<p>\/\/ size of the emission, absorption and bulge sprites,<br \/>\n\/\/ in the center and on the edge of the model<br \/>\nemParticleSizeCenter\u00a0\u00a02.0<br \/>\nemParticleSizeEdge\u00a0\u00a0\u00a0\u00a01.7<br \/>\nabsParticleSizeCenter\u00a01.5<br \/>\nabsParticleSizeEdge\u00a0\u00a0\u00a01.5<br \/>\nbParticleSizeCenter\u00a0\u00a0\u00a01.0<br \/>\nbParticleSizeEdge\u00a0\u00a0\u00a0\u00a0\u00a01.7<\/p>\n<p>\/\/ cutoff brightness for the emission, absorption and bulge sprites,<br \/>\n\/\/ in the center and on the edge of the model<br \/>\nemParticleMinBrightCenter\u00a0\u00a00.5<br \/>\nemParticleMinBrightEdge\u00a0\u00a0\u00a0\u00a00.1<br \/>\nabsParticleMinBrightCenter\u00a00.0<br \/>\nabsParticleMinBrightEdge\u00a0\u00a0\u00a00.1<br \/>\nbParticleMinBrightCenter\u00a0\u00a0\u00a01.0<br \/>\nbParticleMinBrightEdge\u00a0\u00a0\u00a0\u00a0\u00a00.3<\/p>\n<p>\/\/ brightness of the emission, absorption and bulge sprites,<br \/>\n\/\/ in the center and on the edge of the model<br \/>\nemParticleBrightnessCenter\u00a0\u00a00.1<br \/>\nemParticleBrightnessEdge\u00a0\u00a0\u00a0\u00a00.3<br \/>\nabsParticleBrightnessCenter\u00a05.0<br \/>\nabsParticleBrightnessEdge\u00a0\u00a0\u00a05.0<br \/>\nbParticleBrightnessCenter\u00a0\u00a0\u00a00.15<br \/>\nbParticleBrightnessEdge\u00a0\u00a0\u00a0\u00a0\u00a00.0\n<\/p><\/div>\n<p>}<br \/>\n<!--\/uzc--><\/p>\n<\/div>\n<\/div>\n<p><!--\/uzcode--><\/p>\n<p>The nebula model can be described in the same way. Go to the <span class=\"se_path\">addons\/models\/nebulae\/<\/span> folder and create a new text document there. Rename it to <span class=\"se_path\">mymodel.sc<\/span> (the file name doesn't matter), open it in Notepad and type this code:<\/p>\n<p><!--uzcode--><\/p>\n<div class=\"bbCodeBlock\">\n<div class=\"bbCodeName\" style=\"padding-left: 5px; font-weight: bold; font-size: 7pt;\">Code<\/div>\n<div class=\"se_code\" style=\"border: 1px inset; max-height: 200px; overflow: auto; height: 200px;\"><!--uzc--><br \/>\nNebulaModel \"MyNebulaModel\"<br \/>\n{<\/p>\n<div class=\"codepaddingleft\">\nUseForObject\u00a0\"MyNebula\"\u00a0\u00a0\u00a0\u00a0\/\/ name of the nebula for which this model must be used<br \/>\nUseForType\u00a0\u00a0\u00a0\"Diffuse\"\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ type of nebula for which this model must be used\u00a0\u00a0\u00a0\u00a0<br \/>\nMethod\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"CubeMap\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ method of shape generation<br \/>\nPosition\u00a0\u00a0\u00a0\u00a0(0 0 0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ offset of the sprite model<br \/>\nRadius\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(1 1 1)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ sprite model scale<br \/>\nBBoxRes\u00a0\u00a0\u00a0\u00a0\u00a0(4 4 4)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ resolution of the octree for spritesfloatLOD\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\/\/ whether or not to use continuous LOD (0 = false)<br \/>\nLODbase\u00a0\u00a0\u00a0\u00a0\u00a050\u00a0\/\/ LOD base<\/p>\n<p>\/\/ paths to textures (note: \"neg\" images are not used,<br \/>\n\/\/ in that case the \"pos\" textures are used for them)<br \/>\nCubePosXImage\u00a0\"MyNebula\u00a0posx.*\"<br \/>\nCubePosYImage\u00a0\"MyNebula\u00a0posy.*\"<br \/>\nCubePosZImage\u00a0\"MyNebula\u00a0posz.*\"<\/p>\n<p>\/\/ multiplier to the default resolution of the model<br \/>\n\/\/ in radial and Z directions, respectively for<br \/>\n\/\/ emission and absorption sprites<br \/>\nemDetailR\u00a0\u00a01.5<br \/>\nemDetailZ\u00a0\u00a01.5<br \/>\nabsDetailR\u00a01.5<br \/>\nabsDetailZ\u00a01.5<\/p>\n<p>\/\/ colors of the emission and absorption sprites<br \/>\nemParticleColor\u00a0\u00a0(1.0 1.0 1.0)<br \/>\nabsParticleColor\u00a0(0.0 0.1 0.2)<\/p>\n<p>\/\/ displacement of the emission and absorption sprites<br \/>\nemParticleDispR\u00a0\u00a00.5<br \/>\nemParticleDispZ\u00a0\u00a00.5<br \/>\nabsParticleDispR\u00a00.5<br \/>\nabsParticleDispZ\u00a00.5<\/p>\n<p>\/\/ size of the emission and absorption sprites,<br \/>\n\/\/ in the center and on the edge of the model<br \/>\nemParticleSizeCenter\u00a0\u00a01.0<br \/>\nemParticleSizeEdge\u00a0\u00a0\u00a0\u00a02.0<br \/>\nabsParticleSizeCenter\u00a01.0<br \/>\nabsParticleSizeEdge\u00a0\u00a0\u00a01.0<\/p>\n<p>\/\/ cutoff brightness for the emission and absorption sprites,<br \/>\n\/\/ in the center and on the edge of the model<br \/>\nemParticleMinBrightCenter\u00a0\u00a00.05<br \/>\nemParticleMinBrightEdge\u00a0\u00a0\u00a0\u00a00.05<br \/>\nabsParticleMinBrightCenter\u00a00.1<br \/>\nabsParticleMinBrightEdge\u00a0\u00a0\u00a00.1<\/p>\n<p>\/\/ brightness of the emission and absorption sprites,<br \/>\n\/\/ in the center and on the edge of the model<br \/>\nemParticleBrightnessCenter\u00a0\u00a00.5<br \/>\nemParticleBrightnessEdge\u00a0\u00a0\u00a0\u00a00.5<br \/>\nabsParticleBrightnessCenter\u00a01.7<br \/>\nabsParticleBrightnessEdge\u00a0\u00a0\u00a01.7<\/p>\n<p>\/\/ model bounding sphere radius and average color,<br \/>\n\/\/ updated by SpaceEngine automatically<br \/>\nclipRadius\u00a00.928901<br \/>\nsumColor\u00a0\u00a0\u00a0(254 9 4)\n<\/p><\/div>\n<p>}<br \/>\n<!--\/uzc--><\/p>\n<\/div>\n<\/div>\n<p><!--\/uzcode--><\/p>\n<p>Keep in mind that you must describe a galaxy model in the cfg file which is located in the <span class=\"se_path\">*\/models\/galaxies\/<\/span> folder, and a nebulae model - in the cfg file located in the <span class=\"se_path\">*\/models\/nebulae\/<\/span> folder. Only these tags are allowed in the corresponding cfg files:<\/p>\n<p><span class=\"se_script\">GalaxyModel \"name\" { }<\/span> - add\/modify a galaxy model in the galaxy model script,<br \/>\n<span class=\"se_script\">NebulaModel \"name\" { }<\/span> - add\/modify a nebula model in the nebula model script.<\/p>\n<p>Multiple model tags are allowed in the a single cfg file, as well as for SpaceEngine catalogs of astronomical objects. If there are two descriptions of the same model found in the cfg files (tags with the same name, for example, <span class=\"se_script\">GalaxyModel \"MilkyWay\"<\/span>), SpaceEngine will update the older script with the data found in the newer one. So you can modify an existing model by making a new cfg script with the description of that model. <span class=\"se_warn\">Note:<\/span> you must delete the binary file of the corresponding model from the cache to apply the update (see below).<\/p>\n<h4 class=\"se_h4\">The galaxy\/nebula model script details<\/h4>\n<p>Here we will describe all parameters which can be used in model scripts for galaxies and nebulae. They are very similar, though some parameters are allowed only for certain types of object.<\/p>\n<p><span class=\"se_script\">UseForObject<\/span> - specifies which particular object this model must be used with.<br \/>\n<span class=\"se_script\">UseForType<\/span> - specifies which types of objects (procedural or catalog with no model) this model must be used with.<br \/>\nSo you may choose one from 3 types of behaviour:<br \/>\n1) Model is used only for a galaxy\/nebula, whose name is specified in the <span class=\"se_script\">UseForObject<\/span> parameter. The <span class=\"se_script\">UseForType<\/span> parameter is not present. This method is useful for some peculiar galaxies like LMC or Hoag's object, whose models you don't want used for other procedural galaxies\/nebulae.<br \/>\n2) Model is procedurally assigned for galaxies\/nebulae which have no custom models, but have a type, specified in the <span class=\"se_script\">UseForType<\/span> parameter. The <span class=\"se_script\">UseForObject<\/span> parameter is not present. For example, if there are many models with <span class=\"se_script\">UseForType \"SBa\"<\/span>, then all galaxies of \"SBa\" type will use randomly one of these models. This method is useful for \"random\" models, made from art textures, rather than real photographs.<br \/>\n3) Model is used for a galaxy\/nebula, whose name is specified in the <span class=\"se_script\">UseForObject<\/span> parameter, and also procedurally assigned for a galaxies\/nebulae which have a type specified in the <span class=\"se_script\">UseForType<\/span> parameter.<br \/>\nYou must specify at least one of both parameters: <span class=\"se_script\">UseForObject<\/span> and\/or <span class=\"se_script\">UseForType<\/span>.<\/p>\n<p><span class=\"se_script\">Method<\/span> - the method of generating the three-dimensional distribution of sprites of the model. Valid values are:<br \/>\n<span class=\"se_script\">\"Cylindrical\"<\/span> - a cylindrical distribution: the side texture sets the density along the radius \u00ae and height (Z), the front texture gives the density in the XY plane. Example: models of the LMC and SMC galaxies.<br \/>\n<span class=\"se_script\">\"Spherical\"<\/span> - a spherical distribution: the front texture rotates around the Y axis, and thus sets the density of the sprites. Example: model of the Owl Nebula.<br \/>\n<span class=\"se_script\">\"Flat\"<\/span> - a flat layer of sprites, the density is defined by the front texture.<br \/>\n<span class=\"se_script\">\"EllipticGalaxy\"<\/span> - elliptical distribution of sprites, textures are not used. Note that elliptical galaxies in SE uses a custom ray-tracing shader, so the sprite model is not needed for them.<br \/>\n<span class=\"se_script\">\"SpiralGalaxy\"<\/span> - a spiral galaxy, cylindrical method for the disc is used, and elliptical distribution for the bulge is used. Example: almost any model of spiral and lenticular galaxy.<br \/>\n<span class=\"se_script\">\"CubeMap\"<\/span> - the density distribution is defined by the six textures CubePosXImage ... CubePosZImage. These textures describe the projection of a model onto 6 faces of a cube circumscribing the model. The sprite density and colors are obtained by cubic interpolation between these face textures. If some pos\/neg image is not provided, the corresponding neg\/pos image will be used (so at least 3 images must be provided). Example: models of the Carina nebula, Horsehead nebula.<br \/>\n<span class=\"se_script\">\"Diffuse\"<\/span> - a procedural cloud-like distribution, no textures are needed. Example: standard models for procedural diffuse nebulae \"Diff0\", \"Diff1\".<br \/>\n<span class=\"se_script\">\"Planetary\"<\/span> - a procedural spherical-shaped distribution. Example: standard models for procedural planetary nebulae \"Plan0\", \"Plan1\".<br \/>\n<span class=\"se_script\">\"SNR\"<\/span> - a procedural spherical-shaped distribution with thinner walls. Example: standard models for procedural planetary nebulae \"SNR0\", \"SNR1\".<\/p>\n<p><span class=\"se_script\">Position, Radius, BulgeRadius<\/span> - shifts and zooms the sprite model and its parts.<\/p>\n<p><span class=\"se_script\">floatLOD, LODbase<\/span> - sprite model LOD settings.<\/p>\n<p><span class=\"se_script\">FrontTexture<\/span> - the front texture of the galaxy. Rendered as a transparent textured square in the plane of the galactic disk, superimposed on the sprite model. It must have a dust pattern in the alpha channel (see Creating textures). RGB channels determine the distribution and color of the emission sprites, and the alpha channel - the distribution of the dust sprites.<\/p>\n<p><span class=\"se_script\">SysTexture<\/span> - the texture of the subsystems of the galaxy, used to generate procedural objects in the galaxy. R, G and B channels define the distribution of nebulae, open star clusters and blue stars, respectively.<\/p>\n<p><span class=\"se_script\">FrontImage, SideImage<\/span> - textures of the galaxy\/nebula in the frontal and lateral projections, used in the <span class=\"se_script\">\"Cylindrical\"<\/span> and <span class=\"se_script\">\"SpiralGalaxy\"<\/span> methods. For galaxies, the <span class=\"se_script\">FrontImage<\/span> must be reduced to a 128x128 copy of the <span class=\"se_script\">FrontTexture<\/span>, also with the dust pattern in the alpha channel. The <span class=\"se_script\">SideImage<\/span> may be one of the following default side images, or the custom one:<br \/>\n<span class=\"se_path\">S0_side.png, Sa_side.png, Sb_side.png, Sc_side.png, SBa_side.png, SBb_side.png, SBc_side.png<\/span><br \/>\nRGB channels determine the distribution and color of the emission sprites, and the alpha channel - the distribution of the dust sprites.<\/p>\n<p><span class=\"se_script\">CubePosXImage, CubePosYImage, CubePosZImage, CubeNegXImage, CubeNegYImage, CubeNegZImage<\/span> - textures of a galaxy\/nebula as viewed from 6 sides of a circumscribing cube. Used in the <span class=\"se_script\">\"CubeMap\"<\/span> method. RGB channels determine the distribution and color of the emission sprites, and the alpha channel - the distribution of the dust sprites.<\/p>\n<p><span class=\"se_script\">sumColor, clipRadius<\/span> - these parameters are automatically updated by SpaceEngine when creating or updating the model. Used for nebulae. When you create a new model, it is necessary to add these parameters to the script, with any numbers as the initial values, for example:<br \/>\n<span class=\"se_script\">sumColor (1 1 1)<\/span> - overall color of the model,<br \/>\n<span class=\"se_script\">clipRadius 1<\/span> - radius of the bounding sphere;<\/p>\n<p><span class=\"se_warn\">Note:<\/span> all of the following parameters have the same meaning for the sprites of the star disk of the galaxy or emission sprites of the nebula (prefix em), the dust sprites (prefix abs) and the galaxy bulge sprites (prefix b). For brevity, we will describe only the parameters for the emission sprites.<\/p>\n<p><span class=\"se_script\">emParticleColor<\/span> - the color of the sprites, modulates the color of the pixels in the textures. For the absorption (dust) sprites, values are amount of light absorption in the given channel. Good values are <span class=\"se_script\">absParticleColor (0.0 0.3 0.5)<\/span>. This means (roughly) that the sprite absorbs 50% of the passing light in the blue channel, 30% in the green channel, and 0% in the red channel.<\/p>\n<p><span class=\"se_script\">emDetailR, emDetailZ<\/span> - level of detail of the sprite model along the radius and the Z axis:<br \/>\n2.0 - 128 sprites,<br \/>\n1.0 - 64 sprites,<br \/>\n0.5 - 32 sprites, etc.<br \/>\n<span class=\"se_warn\">Note:<\/span> setting a large number may hit the rendering performance very hard!<\/p>\n<p><span class=\"se_script\">emParticleDispR, emParticleDispZ<\/span> - the magnitude of the random offset of a sprite from a rectangular grid, in the radial and the Z-axis directions:<br \/>\n1.0 - the width of the cell,<br \/>\n0.5 - half the width of the cell,<br \/>\n0.0 - no offset, etc.<br \/>\nUsed to reduce the grid effect on the sprite model.<\/p>\n<p><span class=\"se_script\">emParticleSizeCenter, emParticleSizeEdge<\/span> - sprite size at the center and the edge of the model:<br \/>\n1.0 - sprite diameter is equal to the width of the cell,<br \/>\n2.0 - sprite diameter is 2 times greater than the width of the cell, etc.<br \/>\nThe size of sprites interpolates linearly from the center to the edge.<\/p>\n<p><span class=\"se_script\">emParticleMinBrightCenter, emParticleMinBrightEdge<\/span> - the minimum brightness of the generated sprite to include it to the model (at the center and the edge of the model). Interpolates linearly from the center to the edge. If the value in the density map that was built using textures or procedural noise is less than this value, then the sprite in this cell is skipped. Used for optimization of the model - very dark and black (invisible) sprites are excluded.<\/p>\n<p><span class=\"se_script\">emParticleBrightnessCenter, emParticleBrightnessEdge<\/span> - sprite brightness at the center and the edge of the model. Interpolates linearly from the center to the edge.<\/p>\n<p><span class=\"se_script\">emNoiseRandomize ... emNoiseOffset<\/span> - parameters of the noise function (Distorted fBm), which is used in the \"Diffuse\" method of generation (irregular galaxies and nebulae):<br \/>\n<span class=\"se_script\">emNoiseRandomize<\/span> - seed for the generator,<br \/>\n<span class=\"se_script\">emNoiseFreq<\/span> - noise frequency,<br \/>\n<span class=\"se_script\">emNoiseOctaves<\/span> - number of noise octaves,<br \/>\n<span class=\"se_script\">emNoiseDistort<\/span> - amplitude of the distortion,<br \/>\n<span class=\"se_script\">emNoiseLacunarity<\/span> - lacunarity (heterogeneity),<br \/>\n<span class=\"se_script\">emNoiseH<\/span> - the parameter H,<br \/>\n<span class=\"se_script\">emNoiseOffset<\/span> - the shift.<\/p>\n<h4 class=\"se_h4\">Updating the model in the runtime<\/h4>\n<p>When first approaching the created galaxy, SpaceEngine creates a sprite model, using data from the model script and textures specified in it. The generated model is saved in a special binary format to the cache folder <span class=\"se_path\">cache\/models\/galaxies\/*.gm<\/span> (for galaxies) or <span class=\"se_path\">cache\/models\/nebulae\/*.nm<\/span> (for nebulae) and a name that matches the name of the model tag. The next time you load SpaceEngine, it will load the binary file from the cache, instead of generating the model again, which is much faster. If you remove the model file from the cache, it will be generated again using scripts and textures.<\/p>\n<p>You can change the script and textures of the model while running SpaceEngine, and update the model on-the-fly. To do this, you should select the galaxy or nebula you wish to edit, switch to the Edit mode (press the [*] key twice), and press [Ctrl]-[Shift]-[F5]. The model of the currently selected galaxy or nebula will be updated and saved to the cache.<\/p>\n<p>If there is any error while generating or updating the model and the galaxy\/nebula disappears in SpaceEngine, you will need to remove the model from the cache manually and restart SpaceEngine.<\/p>\n<h4 class=\"se_h4\">Creating textures<\/h4>\n<p>Lets take as an example the textures of the M 51 galaxy. It is made based on the Hubble photo of this galaxy (similar to <a class=\"link\" href=\"http:\/\/heritage.stsci.edu\/2005\/12a\/big.html\" target=\"_blank\" rel=\"nofollow\">this<\/a>). Here is a description of steps needed to make a good textures for SpaceEngine from this photo. Textures for nebulae can be made in similar way.<\/p>\n<p>1) The first step is cropping, centering and resizing of the image to nearest power-of-two dimensions. Make it a square with a side of 512, 1024, 2048, 4096 pixels. The higher the resolution, the better. The limit is 4096. Make the texture so that the galaxy is almost fully filled by it. There should be a minimum of unused space around the edges, and the center of the texture should coincide with the center of the galaxy. If the galaxy is seen in the photo slightly at an angle, stretch the image so that it becomes circular (if it is known that it does not feature the actual shape of the galaxy).<\/p>\n<p>2) The next step is removing of the background stars (which this image almost doesn't have, luckily). In Photoshop, one tool for removing stars is Filter -&gt; Noise -&gt; Dust &amp; Scratches. Another possible way is to copy the original texture layer twice, blur the top layer (Filter -&gt; Gauss blur, or Box blur), and use a Difference blending mode for second layer. This isolates small details - the stars. Then merge the top two layers and set a Difference blending mode for the merged layer. This cases the small details to be subtracted from the lower (original) layer. Then use the tool Image -&gt; Adjustments -&gt; Levels to pick up the black level of the upper layer to a more precise subtraction of the stars. The brightest stars should be removed manually by copying the neighboring areas of the image (eg. with the Clone Stamp Tool). There is some noise left after removing the stars, and it must be smoothed out in some way, for example by walking through the image with a Blur tool, leaving the dust\/nebula details where they should be, but smoothing out the noise from removed stars.<\/p>\n<p>3) Increase the contrast of the image, and attenuate (fade) the edges. It must completely fade to black at the edges, otherwise edges will be very noticeable in SpaceEngine. Here is the example of what you must achieve (click to enlarge):<br \/>\n<img decoding=\"async\" src=\"https:\/\/spaceengine.org\/media\/2016\/11\/2539583.jpg\" width=\"256px\" \/><\/p>\n<p>4) The next step is selecting the interstellar dust pattern. Dust is brown streaks visible on the galaxy's spiral arms. Near the center you can see how they gradually disappears into a yellow \"fog\" - the spherical bulge of the galaxy. Select the dust like you selected the stars, or use the tool Select -&gt; Color Range. Create an alpha channel and copy the selected dust there. Bright areas in the alpha channel must outline the dust in the galaxy, so you may need to invert the image. Here is the example of what you must achieve in the alpha channel (click to enlarge):<br \/>\n<img decoding=\"async\" src=\"https:\/\/spaceengine.org\/media\/2016\/11\/7813723.jpg\" width=\"256px\" \/><\/p>\n<p>5) Create a small version of this texture i.e. just a reduced 128 x 128 copy of the front texture. It is used as \"LOD 0\" texture if the galaxy is far away, and also for generating the 3D sprite model. <span class=\"se_warn\">Note:<\/span> Photoshop likes to add a thin gray frame around the image while rescaling. So make sure you have removed it with the eraser tool or another method. Look at the small texture example below: its alpha channel has a noticeable frame. If not removed, these gray pixels may lead to generating redundant sprites in the 3D model.<br \/>\n<img decoding=\"async\" src=\"https:\/\/spaceengine.org\/media\/2016\/11\/3852830.jpg\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/spaceengine.org\/media\/2016\/11\/9912873.jpg\" \/><\/p>\n<p>6) Now it's time to create a subsystems texture. Create a new document (image) with the same dimensions as the edited (big) front texture. Then copy the RGB image of the front texture into that new document. The subsystems texture is a pattern which is used to generate procedural diffuse nebulae (the red channel), open star clusters (green channel) and the young blue stars (blue channel). So it can easily be made by adjusting the levels\/contrast in each of the color channels separately. You also need to erase the galaxy core - there must be no nebulae, star clusters, or blue giants generated. You can use the hand tools Burn and Dodge to enhance star forming regions (in the blue channel) and nebulae (in the red channel). If galaxy image has no very well defined nebulae, you can copy the dust distribution map to the red channel and (nebulae appear near dust clouds). Here is an example of what you must achieve (click to enlarge):<br \/>\n<img decoding=\"async\" src=\"https:\/\/spaceengine.org\/media\/2016\/11\/s7395670.jpg\" width=\"256px\" \/><\/p>\n<p>7) Save the files. It is recommended to save the front texture and its small version into alpha-PNG format. <span class=\"se_warn\">Note:<\/span> Photoshop can't save PNG with the alpha channel, so it is better to save the texture in TGA format, and then convert it to PNG using SpaceEngine. It has an option for converting any texture to any supported format, correctly saving the alpha channel. To use it, run SpaceEngine, open the console with [~] key and type:<br \/>\n<span class=\"se_code\">SavePNG addons\/textures\/galaxies\/MyGalaxy.tga<\/span><br \/>\nwhere MyGalaxy.tga is the file name of the texture you want to convert. This command loads the texture MyGalaxy.tga and saves it with name MyGalaxy.png, to the same folder. There are commands for converting to all other formats available: <span class=\"se_code\">SaveJPG, SaveDDS, SaveTGA, SavePNG, SaveTIF.<\/span><br \/>\nThe subsystems texture can be saved in any format, including JPEG\u0431 because it does not have an alpha-channel.<\/p>\n<p>8) You can edit the model script and textures while running SpaceEngine, and update the model on-the-fly. To do this, select the galaxy you are editing, switch to the Edit mode (hit the [*] key twice), and press [Ctrl]-[Shift]-[F5]. The model of the galaxy that is currently selected will be updated.<\/p>\n<p>Good photos of galaxies can be taken from <a class=\"link\" href=\"http:\/\/heritage.stsci.edu\/gallery\/gallery.html\" target=\"_blank\" rel=\"nofollow\">the Hubble website<\/a>. Choose the galaxies which have full coverage in the frame, using images that were taken in the visible part of the spectrum, in natural color. It is better to grab photos in TIFF format without compression so there will not be JPEG compression artifacts.[\/vc_column_text][\/no_accordion_section][\/no_accordion][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>[vc_row row_type=\"row\" use_row_as_full_screen_section=\"no\" type=\"full_width\" text_align=\"left\" box_shadow_on_row=\"no\"][vc_column][no_accordion active_tab=\"1\" background_transparency=\"no\" style=\"boxed_accordion\"][no_accordion_section title=\"Creating a deep space object\" accordion_type=\"accordion_icon\" icon_pack=\"font_elegant\" fe_icon=\"icon_cog\"][vc_column_text]This manual describes how to add a galaxy, star cluster or nebula to SpaceEngine. Before continuing, it is recommended that you read this manual: Introduction. Galaxies, star clusters and...<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":519,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-631","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/pages\/631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/comments?post=631"}],"version-history":[{"count":18,"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/pages\/631\/revisions"}],"predecessor-version":[{"id":1477,"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/pages\/631\/revisions\/1477"}],"up":[{"embeddable":true,"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/pages\/519"}],"wp:attachment":[{"href":"https:\/\/spaceengine.org\/wp-json\/wp\/v2\/media?parent=631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}