3 ms·
I recently took an old-school "voxel" algorithm and munged some NASA moon terrain data to try to create a game. I really have enjoyed learning about the Moon's
by JKCalhoun 5y ago
I recently took an old-school "voxel" algorithm and munged some NASA moon terrain data to try to create a game.
I really have enjoyed learning about the Moon's geography just from flying around the terrain, picking locations for "lunar bases" and such. Fascinating cracks and valleys, grooves, a straight mountain range — in general things I was not expecting on a planetoid without water/erosion.
It really is stark how different the far side of the Moon is from the near side. Insanely pock-marked with so many craters.... I assumed there was an Earth component to that in the same way the Earth has locked the Moon into an orbit/rotation that is always facing us.
I'm become very keen to learn more about the Moon now.
- Teever 5y agoCan you talk more about the moon data munging? I just started some Blender tutorials and the first thing I want to try once I get some tutorials under my belt import dats from the Moon/Mars.
- JKCalhoun 5y agoSure. For the Moon the (images) data seems to be bucketed with regard to pixels-per-degree (PPD), the more coarse data set being 64ppd data (finer resolution for the Moon goes at least as high as 512ppd that I have found). Sadly, my workflow (image editors, and Blender as you mentioned) are already straining with the 64ppd data-set so I did not try to go higher resolution. It means though that my Moon is wildly small — the lunar bases that seem to be a paltry 7x7 or 9x9 voxels are in fact the size of a small town. I began with NASA's "CGI Moon Kit" [1] which, as I say, is 64ppd. There is both a "color data" image and an "elevation data" image (where the greyscale value of the image represents elevation). Polar data was garbage (and would look wildly distorted in my tile-based voxel algorithm so I confess that I tossed it — cropped everything outside 60-degrees latitude basically - I just limit fuel in the game to keep pesky kids from trying to get too deep into the polar regions). Even at 64ppd and poles cropped, I still ended up with two images that were 23040 × 11264 pixels in size. This turned out to be a challenge for most of the image editing apps I have. Blender handled it (but barely). With both color + elevation images I followed an online tutorial [2] meant for cartographers wanting to use Blender for relief shading. NASA's moon map had no shadows (probably a good thing). I was not going to try to real-time shade/light the voxel terrain so I settled on "burning in" the shadows with Blender. While my MacBook ran some 8 hours or so (over night) to generate the relief-shaded lunar map, the result was quite nice. As a result, it is near sunset everywhere on my Moon, ha ha. With a relief-shaded image representing the color and a same-sized image representing the elevation, I wrote a custom app to read both files into memory and then generate the correct number of 512 x 512 tiles that contain both the elevation data and RGB data in a single raw file. Now I have 45 x 22 raw tiles covering the entire 64ppd Moon. The voxel algorithm uses simple math to figure out which tile a given voxel is to be found, reads the elevation/color data. In hindsight, I could have output PNG files or something with alpha channel (where alpha would be interpreted as elevation). As it turned out, the Moon color was so close to greyscale that I ended up treating it as such and used only the green channel when creating my Moon tiles (so the tile data has only a single 8-bit value for elevation and a single 8-bit value for "color" per voxel — cut the raw tile size in half). Still wrapping up the game [3]. I'll put the sources up on Github end of the month, I think. [1] https://svs.gsfc.nasa.gov/4720 https://svs.gsfc.nasa.gov/4720 [2] https://somethingaboutmaps.wordpress.com/blender-relief-tutorial-blender-basics/ https://somethingaboutmaps.wordpress.com/blender-relief-tuto... [2] https://mooncraft2000.com https://mooncraft2000.com
- bdefore 5y agoFascinating. Are there upcoming plans from any space agency to improve that 64PPD with upcoming or existing satellites or Earth-based capture of moon topography?
- JKCalhoun 5y agoThere are 512ppd data sets [1] already. As I say, I found them unwieldy with my workflow. A new workflow would be required to process these into "game tiles". [1] https://astrogeology.usgs.gov/search/map/Moon/LRO/LOLA/Lunar_LRO_LOLAKaguya_DEMmerge_60N60S_512ppd https://astrogeology.usgs.gov/search/map/Moon/LRO/LOLA/Lunar...
- bdefore 5y agoWhoops. I missed that you mentioned higher PPD is available. If your workflow was improved to accommodate it, I presume it would produce more, for lack of a better phrase, life-like terrain? Would a much higher PPD be required to reach a threshold to improve the experience. And are there plans coming to get finer detail than 512PPD?
- JKCalhoun 5y agoIt occurred to me that, beyond 512ppd, you could "synthesize" higher-res detail. I don't know how much of a cop-out that is though. There may be >512ppd data though. IANAS (I am not a selenologist).
- 127 5y agoI did some cropping of the LOLA dataset to a .raw that Unity3D could understand as terrain input: https://github.com/amb/SplitTIFF https://github.com/amb/SplitTIFF ... a couple of years ago Happy to hear any better alternatives for the task.
- JKCalhoun 5y agoThat is very cool. I starred your repo, if I try to up the PPD I'll have a closer look.
- gehwartzen 5y agoBecouse of the orbital lock it’s interesting to think of it like a shield for earth. I imagine a lot of those craters were by asteroids that would have hit earth, esp the perfectly round ones in the center. The oblong ones or ones towards the edges might have come at an angle that wouldn’t have hit earth. Seems like a fascinating way to study earths impact history if we end up exploring the dark side of the moon in more detail.
- JKCalhoun 5y agoI also am fascinated by the idea of Nemesis [1] — an infrequent event that causes mass-impact throughout our solar system. [1] https://en.wikipedia.org/wiki/Nemesis_(hypothetical_star) https://en.wikipedia.org/wiki/Nemesis_(hypothetical_star)
- bdefore 5y agoDo we have an idea of what percentage of impacts were prevented this way? What likelihood is there that the moon saved humanity (more than once?) since the time that we descended from the trees?
- gehwartzen 5y agoI imagine once you figure out which craters correspond to ones that came in at an angle which would have hit earth and compare that to all the impacts you have had on earth one could figure it out. The thing is that on the moon the craters remain visible for a much longer period of time while on earth they get covered up by plate shifts, erosion, ocean impacts, etc. So instead it might be a way to calculate how many asteroids likely have hit earth in general throughout history whether we have found the craters on earth or not. Then you could calculate based on the size of the craters on the moon which ones would have been earth catastrophic events (taking into account any diminishing impact energy due to our atmosphere). Which would tell us how many the moon saved the earth from. In terms of how many since human ancestors were evolving we would have to then date earth catastrophic craters on the moon. I'm not sure if this can be done through photographs or if we would have to get surface samples. Then comparing that number to the fraction of earth covered/protected by the moon to the total area on earth we would have a decent idea of how many of these events happened one earth even if we haven't discovered the evidence for them on earth.