Importing third-party data into X-Particles

For this example we will import some data from a completely different source into XP. The source we'll use is a star database developed at the Astronomy Nexus. If you go to that link, you will see three files for download. The one you need is the one named 'HYG 2.0' so download that and unarchive it to a suitable location. The archive has one file which is named 'hygxyz.csv' - make sure you have the correct file.

If you open this file in a text editor or spreadsheet, you can see that it has almost 120,000 lines - it's a big database! Each one is a star, with a lot of information - not all of which we can use. In fact, we're just going to use the star position in X, Y, and Z coordinates, and the colour index.

To set this up, follow this sequence:

  1. Create a new scene and add an emitter and a Data Importer object
  2. Drag the emitter into the data importer object and navigate to the file 'hygxyz.csv'
  3. Change the 'Max. Records to Load' value to 200,000 to load all the stars - in this data source the stars are sorted by their right ascension so if you only load some, you will only see a wedge-shaped section of the available stars
  4. Change the 'Color Space' to 'Color Index'
  5. In the 'Field Mapping' tab, add four maps
  6. The first three should be named, 'X', 'Y' and 'Z' and mapped to the corresponding coordinate ('Position: X', etc.)
  7. The fourth map should have the field name 'ColorIndex' (you can see this field in the .csv file) and the data should be set to 'Color: Red'

The mapping tab should look like this:

  1. Click the 'Load Data' button to load the data; it will take a few seconds to load
  2. Finally, advance the scene to the first frame to create the particles - again, it may take a second or two to create all those particles

If you add an XP material to the emitter and render the result you can see what the centre of the galaxy looks like from a distance: