Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Space, The Final Frontier

Author
Message
Vidiot
18
Years of Service
User Offline
Joined: 15th May 2006
Location: TN
Posted: 16th Nov 2013 23:10
Hi Guys,

The attachment is a csv data file describing the location and brightness of 15448 stars. The original file was over 20 megs and contained lots of data about 119000 stars. I extracted only the brightest stars, of magnitude 7 or brighter.

The program uses a few functions from the Enhancements pack to access fields in the csv file. Naturally, you would have to edit the path shown in line 9 where I have "E:\TFF\shortlist.csv" to the path where you place the attached file.

All I do is create triangle objects whose size and brightness are based on the magnitude of each star. I only have it loading the first 5000 stars because creating 15000 objects is just too much for my system. It was taking over 30 seconds just to start up, but with 5000, it starts up in seconds. You can change the "for star =" loop to "5000 to 10000" or "10000 to 15000" to see other parts of the sky.

Its fun to scroll around on because the data is real and you will recognize some constellations pretty clearly. Orion is easy to spot. I have left & right arrow keys and page up and page down to scroll around and up & down arrow keys to zoom in and out. Q quits or just hit escape.

The point of this exercise was just to see if I could access the data and turn it into something recognizable. Next, I'd like to figure out how to set them up in a realistic 3d space. The original database has distance, colortype and all sorts of other data.

If you're interested the original 20 meg dataset can be downloaded here:
http://astronexus.com/files/downloads/hygxyz.csv.gz




The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.

Attachments

Login to view attachments
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 22nd Nov 2013 21:24
Sounds cool, but I don't have the enhancement functions.

Would you consider uploading an .EXE of this?

D.D.
Vidiot
18
Years of Service
User Offline
Joined: 15th May 2006
Location: TN
Posted: 23rd Nov 2013 01:37
Sure.

I just modified the code removing the path where I previously had the shortlist.csv file. Now, so long as they are in the same directory, the program should find the csv file.

Attached is the astro.exe and data file is still attached to the previous posting.

The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.

Attachments

Login to view attachments
Vidiot
18
Years of Service
User Offline
Joined: 15th May 2006
Location: TN
Posted: 23rd Nov 2013 02:34 Edited at: 23rd Nov 2013 02:36
By the way, you could rewrite it easily enough to avoid the functions of the enhancements pack. The csv file is just plain text so it could be read as strings by the regular dbpro functions and then separated by the commas, converted to values and so on. It would only be a little bit more cumbersome that way than it is now.

The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.
The Tall Man
11
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 19th Dec 2013 00:07
Hey what a great idea!!

Q: ...you mean computer imagery was still based on the paradigm that the world was flat? Even into the 21st century??? Talk about doing something the hard way!

A: Yep! Back then people would render simple shapes with complex meshes of thousands of flat little triangles. Next to the bottleneck processors they used, it's the main reason why their computers were so slow. In the last days of the religious atmosphere of centralization and trade, corporate dogmas had people believing that flat was faster.
The Tall Man
11
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 19th Dec 2013 02:20 Edited at: 19th Dec 2013 02:24
To borrow from an idea that Lee's using - imposters. You could render your stars onto a skysphere (or skybox), save that to a file. Then have the same experience with only a minimal loading time or resource usage. You can create your skysphere, for example, to have as many surfaces (and hi-res textures) that you wanted to, if you wanted to keep the detail. If you're going to do that, you can use squares instead of triangles - it's only 1 more vertex (if you create them yourself instead of using the create plane command). One advantage you already have to rendering speed is that you have no need of texturing. So perhaps you could experiment with compressed textures or ones that use less bits, or that are alpha textures in front of a white background - see if anything speeds it up. The faster it renders, the less need you'll have to sacrifice resolution in your textures.

Edit:
Independent of this idea - you could speed up loading time by converting your table to a binary format, instead of text. Or better yet, if you create your meshes, then add them all to the same object, then just save your object.

Q: ...you mean computer imagery was still based on the paradigm that the world was flat? Even into the 21st century??? Talk about doing something the hard way!

A: Yep! Back then people would render simple shapes with complex meshes of thousands of flat little triangles. Next to the bottleneck processors they used, it's the main reason why their computers were so slow. In the last days of the religious atmosphere of centralization and trade, corporate dogmas had people believing that flat was faster.

Login to post a reply

Server time is: 2024-11-21 12:21:43
Your offset time is: 2024-11-21 12:21:43