Categories

Procedural universe, galaxy, star and planet generation engine

Galaxia now in UE4

So, it’s been a fair while since I’ve written anything on here, sorry about that! I have however still been working on Galaxia, and as the title suggests, it’s now in Unreal Engine 4! I’ve also made quite a few upgrades while porting the code over and learning about UE4.

Here’s a video showing the UE4 guy flying around the Galaxia Universe:

Probably the most noticeable recent change is the galaxy dust. I’m still using the same basic technique as in my previous posts, except that now there’s a texture being used to give a higher detail to the clouds. It’s making full use of mipmaps and anisotropic filtering to deal with aliasing issues, since it’s still an essentially rasterisation-based approach.

I’ve also included the use of textures with anisotropic filtering for the planet rings, which allows for finer details. The technique consists of making a line through a grayscale noise texture when drawing the rings, by using inner and outer UV coordinates. The pixel shader for the rings just determines how far between the inner and outer radii the current pixel is, and samples the noise texture at the appropriate point along that line. A second noise sample with bigger UV’s is added for extra detail, and a separate colour noise texture is also sampled to add colour variation.

I’ve also added binary star systems, and completely rebuilt the star system generating code to support those. Both inner and circumbinary orbits are being generated, which now allows for quite an interesting variety of star systems to appear. Binary planets are now possible, and due to the new recursive nature of the algorithm, under the right circumstances it’s even possible for moons to be orbiting other moons. The sphere of influence for each mass is used to determine how big the moons’ orbits could be, and how many moons a planet could have.

Lighting for planet atmospheres and rings also had to be upgraded to support the multiple light sources, and shadows from those. This does unfortunately mean the shader complexity for those has increased, but thankfully there hasn’t been any performance issues yet.

Terrain has also been an area of active development, since I need to do things a little bit differently in UE. Since the UE world needs to interact with the terrain for things like collisions and object placement, I need to take a different approach to at least the highest detail (i.e nearby) terrain, to be able to use UE materials and deferred shading to their maximum extent. I’ll try to write more about that in the future, when I have something in more of a working state.

As shown in the above screenshot, I’ve been playing around with using textures and bicubic sampling for generating the terrain, instead of just noise functions. Not sure how I feel about this approach yet, but it’s yielded some interesting results so far. Texture aliasing on the terrain is still quite bad due to the generated normalmaps not having any mipmaps, but the atmosphere tends to mask the issue. It becomes quite ugly for smaller planets/moons which don’t have an atmosphere. I think the solution to the problem is to not use generated normalmaps, but rather use a more conventional approach with vertex normals and texture blending.

Another recent addition is the simple anamorphic lens flares, which make the nearby stars more obvious. I think some more radial flares are still required, and possibly some textures as well, so I’ll be playing around with those more in the future.

That’s about it for now! If you made it this far, you might be interested in the Galaxia Discord server. I try to post more frequent updates and screenshots in there, and you can chat about Galaxia with me in real time!

This sir, is incredible.
I am currently working on a space game along the lines of kerbal space program and have had to get around the issues of floats, your post on the coordinate system is fascinating and very helpful.
Don’t suppose i could ask a few questions on how to solve some issues in my project that you have overcome with this?