Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (292)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Galaxy demo  (Read 847 times)
0 Members and 1 Guest are viewing this topic.
Online StrideColossus

Senior Member


Medals: 3
Projects: 1



« Posted 2013-02-09 13:13:57 »

As a slight departure from my usual projects I thought it would be nice to see an animated galaxy model.  I was hoping that there would be star coordinate data freely available on t'interwebs, Hipparcos is one, but the data is only for relatively nearby stars so you just end up with a sphere of stars centred on the Sun - not very interesting.

So I changed tack and re-used my terrain mesh building code to load a picture of a galaxy as a height-map.  I used this one (can't remember which galaxy it is though):



Obviously there is no 'height' as such in a flat image, to generate the galaxy disk and bulge I randomized the vertical coordinates, with the range being higher in the bulge and tapering off towards the edge of the disk.  The colours of the 'stars' are the pixel colours in the image, after discarding pixels with a total luminance below a certain threshold, i.e. the resultant model does not have a 'star' for every pixel of the image, only the brightest ones.

Here's a side-on view:



Edge on:



Close-up:



The galaxy model is rendered using a 'point cloud' mesh re-used from my particle system code, each 'star' is a point-sprite with the shader creating a imposter sphere, blended with the stars behind it and ordered by distance.  With the cut-off threshold I applied there are about 50K stars in the model and it renders way above 60 FPS, though obviously goes slower as more stars are added.

I'm quite pleased with the results for what turned out to be relatively little work using (largely) existing code.  It's far from perfect and there's plenty more that could be done: it doesn't look too great close-up (perhaps to be expected), and the blending can look a bit clunky sometimes (need to experiment with other functions).  I'd be interested to see if anyone else has tried anything similar.

- chris
Offline Varkas

JGO Knight


Medals: 14
Projects: 5


iDream


« Reply #1 - Posted 2013-02-09 13:23:35 »

So I changed tack and re-used my terrain mesh building code to load a picture of a galaxy as a height-map.  I used this one (can't remember which galaxy it is though):

The structure matches our own galaxy. The short central bar, and the branching arms match quite well. There sure are enough barred spiral galaxies which looks similar, but bets are that this is a visualization of our own galaxy.

if (error) throw new Brick();
Online StrideColossus

Senior Member


Medals: 3
Projects: 1



« Reply #2 - Posted 2013-02-10 12:37:32 »

The structure matches our own galaxy. The short central bar, and the branching arms match quite well. There sure are enough barred spiral galaxies which looks similar, but bets are that this is a visualization of our own galaxy.

Expect you're right, I think I remember finding that image when searching for Milky Way star data, and our galaxy is suspected to be a barred spiral.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline delt0r

JGO Coder


Medals: 18


Computers can do that?


« Reply #3 - Posted 2013-02-11 13:01:10 »

Its not our galaxy. It is one that is like ours... we think. Remember we only decided it was a bar galaxy pretty recently.

The star catalogs work for close stars. That is ones where we can measure the distance via the parallax method. This works out to a few 100lty IIRC. The milky way is about 100,000lty across, and contains something like 100 to 400 billion stars.   

Interesting approach.

I have no special talents. I am only passionately curious.--Albert Einstein
Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (67 views)
2013-05-17 21:29:12

alaslipknot (76 views)
2013-05-16 21:24:48

gouessej (108 views)
2013-05-16 00:53:38

gouessej (104 views)
2013-05-16 00:17:58

theagentd (115 views)
2013-05-15 15:01:13

theagentd (104 views)
2013-05-15 15:00:54

StreetDoggy (149 views)
2013-05-14 15:56:26

kutucuk (172 views)
2013-05-12 17:10:36

kutucuk (170 views)
2013-05-12 15:36:09

UnluckyDevil (179 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.079 seconds with 20 queries.