Procedural night sky

I’ve posted a web demo.
http://hexara.com/Starfield/

Links is also at the top of this thread, and runnable jar with source code link, too.

Thanks for sharing, looks awesome! :slight_smile:

Would you mind making the main post a little bit nicer? just for future reference and quick find for download link and the web demo :slight_smile:

Are the ‘nebula’ generated too?

Endolf

It’s ‘nebulae’ (plural)
:stuck_out_tongue:

Whatever, the question still stands :slight_smile:

[quote]Are the ‘nebulae’ generated too?
[/quote]
Yes. The object is called GalacticCloud. At this point, the api is just a rectangular size, and the object returns a BufferedImage generated with a bit of Simplex noise and a utility I wrote to blend the edges to alpha = 0 (fully transparent). I then use another utility I just wrote to rotate the image slightly. All this code is in the jar, and folks are free to use it.

If anyone does, I’d be pleased to get a link to post so as to brag on my blog (in the works still) about writing code that is actually useful. :slight_smile:

I probably won’t use the src, but I will use the inspiration! Looks amazing, and I am definitely going to put something like that in my game.

[quote=""]
NASA? Not familiar with that algorithm, although it does spark my Curiosity

Lame joke aside, when playing Freelancer, I always noticed how the skyboxes (starboxes) were carefully designed to reflect your position in the game’s starmap (So if you took the jumpgate towards a distant green nebula, you’d end up finding said nebula). So when thinking about making a similar space exploration game, actually having a procedurally generated background based on the player’s position is something I find very attractive and have mused about quite a bit.

So yeah, can’t get enough of procedural sky generation ;D

@Oskuro – For 3D, I’d give each star a Z coordinate to go with the X & Y, and instead of having two shapes for the twinkling, there would be a larger series of shapes for a given star, one of which would be selected based on distance.

I haven’t taken the time to play around with 3D very much yet. But it seems quite doable, albeit with a lot of trig calculations. (I’m assuming there are known 3D techniques for optimizing that sort of thing which I have yet to learn.)

@OpenGLShaders – Thank you. I look forward to seeing your game!