Hi,
I wanted to replace the Earth textures with the Moon's and, no surprise, it ended up being ugly.
First of all the moon altitude range between the deepest point and the highest point is 18km, for a radius of 1700km, that is more than 1% of the moon radius!!! On earth, that does not exceed 1 per mil. Then no atmosphere, no reflection, no specular light, the bloody moon is just diffusive dust for which the Lambert law is plain wrong. You can really spot it by eye.
So, I've tried to understand what is a shader last week, and I ended up with this:
viewtopic.php?f=19&t=37534The best tutorial I've found online, more accurately the one I did understand, is this one (thanks Thorsten):
http://www.science-and-fiction.org/rendering/glsl.htmlI really did find it by "duckduckgoing" GLSL, tutorial, shaders etc... LoL
So I am not the only one to like it
That is still a ugly hack, nothing physical in altitudes of the UFO, the sun is not at the right place of course, and this creates issues because there are permanent shadows around the Moon's pole, which should never been lighten. I've been using the LROC images, and they are not illuminated at 90 degrees (for the previous reasons as well). There are LROC photometric flat images online but they all lack the poles, too bad
Anyway, here are the hacks:
The texture generator, fully inspired by Chris's (By the way Chris, I've solved the polar cap projection problem, the solution is called gdalwarp!)
https://github.com/eatdust/normalmaphttps://github.com/eatdust/LROC2FGearthviewEdit: Texture generated available here:
MoonView/Pay attention to use the latest version of normalmap. I have indeed discovered that the high-res normalmaps we are currently distributing with NASA2FGEarthview have a problem. The "y" component seems to be flipped compared to what flightgear expects. It is almost unnoticeable while viewing the Earth because it mostly tilts the shadows by 45 degrees. But for the Moon and its huge relief, that was very clear, took me a while to understand (I'll fix the files as soon as I can).
A bit of tweaking for the files loaded by Earthview:
https://github.com/eatdust/moonshadersThis is only what have been changed compared to the distributed files, earthview is left untouched. Textures should go under the directory Models/Astro/Textures/ as usual. This is for moon_*.png texture files, the LROC generator produces dds files as well, but color artifacts are quite visible. If you lack graphic card memory, the dds are better suited, replace moon_*.png by moon_*.dds in all the ac files then (make a backup of the old files and directories).
Finally, it is difficult to remove the sky in FG
But this is doing quite a good job if you don't fly too low:
- Code: Select all
fgfs --aircraft=ufo --prop:/sim/rendering/shaders/skydome=false
This disables ALS as well, so the SpaceShutte looks ugly around the Moon
Concerning textures size. If you have a big graphic card, the 16k heights and surface textures will take 6.2GB of graphics memory in total, so a recent 8GB G-force works with:
- Code: Select all
--prop:/earthview/show-force-all=true
For more modest cards, the 4096 textures are already super nice, and they load fast. I did not try the lowest resolution textures, 1k and 2k, but they should be fine for the even more modest cards. I'll try to generate all texture sizes and put them online, but it takes quite some computing time...
I am not sure there is a future for this thing, we cannot go to the Moon with flightgear, but that was fun. And I would have never believed before that a simple normal map could render the relief as good as that. So cool.
Still need some shadows though!
I hope I did not forget a tweak file, ping me if required!
Cheers,
Chris.