When I woke up on the morning of January 2nd and checked my email messages, I found a nice present sent to me by Sebastian Macke.<\/p>\n
But first, who is Sebastian?\u00a0 He is the guy behind the Starflight reverse engineering project that you can find here<\/a> on GitHub.\u00a0 I stumbled across this project while looking for data relating to Starflight in November and immediately reached out to him to see if he could help me out.\u00a0 This project is awesome – he basically created what is essentially a Starflight decompiler that will take the Forth bytecode from the binary program, and convert it to C code.\u00a0 Unfortunately, he is not far along enough in his project to be able to give me the information I needed, as many of the function names are still obfuscated\u00a0Forth command words.<\/p>\n Fast forward to today.\u00a0 In the email, he wrote that he was able to gain access to the fractal planet generator in the original game!\u00a0 He went ahead and generated the raw height and color map for all 811 planets in the game, and sent them to me.\u00a0 What a nice surprise!\u00a0 The height maps he had sent me were of much higher fidelity than what I was able to extract from screenshots of the game.\u00a0 So, obviously, I had to incorporate this treasure into the fractal planet generator that I had developed for the remake.<\/p>\n You might want to refresh your memory at this time – go ahead and visit the original planet generator post here:\u00a0https:\/\/bravearmy.com\/starflight\/2018\/10\/01\/final-planet-generator-non-gas-giants\/<\/a><\/p>\n Okay, so the first step was to bring in the height and color maps that Sebastian made:<\/p>\n Note how there are smooth transitions in the grayscale height map which is the top half of the image?\u00a0 There are so many levels in that greyscale map.\u00a0 Compare that to only 6 levels in the color map in the bottom half.<\/p>\n The next step is to add some padding to the top and bottom of the map to avoid the pole pinching issue, as was described in the original planet generator post:<\/p>\n Now, here we do something a little differently compared to how we were doing it with the original planet generator.\u00a0 Because of the low fidelity of the original elevation data, I had to come up with a custom way to scale the maps up – creating a “contours” pass and a specialized scaler.\u00a0 Now with the higher fidelity elevation data, we do not need to do any of that.\u00a0 Here, I just use standard bicubic (Hermite) scaling to bring the elevation map to 2048 by 1024 resolution.<\/p>\n Below is an image of the elevation data but colorized so it is easier to see the fine details.\u00a0 It is really hard to see details in a straight grayscale map.\u00a0 In these images I use the green channel for the straight elevation, the red channel is the elevation wrapped around 16 times to show banding, and the blue channel is “on” where the elevation is below the water height, and “off” where it is above.<\/p>\n Next, I create the mountains the same way as I previously did with the original planet generator.\u00a0 Very little has changed – it’s the same mountains generator.\u00a0 I build the mountains\u00a0above the water level, making the mountains bigger in the higher elevations.<\/p>\n Now, I run the hydraulic erosion simulation process.\u00a0 Again, nothing has changed here… its the same process with the previous planet generator.\u00a0 Now we end up with this elevation data:<\/p>\n Now that I have the final elevation data, I generate a “difference” map which is the difference in elevation between the bicubic scaled elevation data, and the final elevation data.\u00a0 This allows me to store high fidelity elevation data at in far less space compared with saving out straight floating point data.<\/p>\n Finally, it is time to create the actual game texture maps from this elevation data.\u00a0 I have much improved this part of the process.<\/p>\n First, the albedo (color) map.\u00a0 Instead of translating the elevation directly into colors, I use a dithered version of the original color map.\u00a0 This allows for more variation in the coloring of the terrain.\u00a0 Secondly, (and this is new) I bake in the ambient occlusion into the albedo map.\u00a0 What is ambient occlusion?\u00a0 Basically, it is darkening the parts of the map that gets less light, such as where there are creases or valleys.\u00a0 I think this made a huge improvement to how planets look.\u00a0 Finally, I color the map where there is water.\u00a0 The water coloring process is also different and much improved as well.\u00a0 In the shallow water areas, I allow more of the soil and mud to show through.\u00a0 I could not do this with the old elevation maps because I had no elevation data below the water level.\u00a0 Here is the result:<\/p>\n Here is the normal map generated from the elevation data:<\/p>\n And the specular map:<\/p>\n And the water map mask:<\/p>\n Put it all together and we get this…<\/p>\n These images are actually 4k images (yes, you can run Starflight in full resolution on 4K and 8K screens!) which will allow you to see the planets in better detail when you zoom onto them.\u00a0 To do that, click on the image, and then when the image pops up on your screen, right click on it and select the “open in new tab” option.\u00a0 This will open the full-sized image into a new browser tab, and in that tab, you are able to zoom in.\u00a0 You can also download them to your computer.<\/p>\n Here’s another one…<\/p>\n And here is what Arth looks like now…<\/p>\n
<\/a><\/p>\n
<\/a>\u00a0
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n