Board index FlightGear Development Spaceflight

Earthview - an orbital terrain rendering engine [v2.0]

Discussion about development and usage of spacecraft

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby galvedro » Tue Apr 29, 2014 8:25 pm

Hopefully fixed.
https://gitorious.org/fg/galvedros-fgdata/source/0d64dc91999104b3c5ba49748efd38e421d0f105:Models/Astro

I will work on the cloud sphere next. What source have you used for the texture? I may need to tweak them a bit.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby Thorsten » Wed Apr 30, 2014 6:06 am

Thanks, I'll check it out!

The cloudsphere is also from NASA's Visible Earth collection here

I think if the lighting/fogging seams are gone and textures correctly placed, then the visual impression should be okay though...
Thorsten
 
Posts: 11113
Joined: Mon Nov 02, 2009 8:33 am

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby Thorsten » Wed Apr 30, 2014 7:01 am

Great - the seams are really gone :-)

What exactly do you tweak in the textures? Ultimately I'd like to have my hires dds set, but there's no easy way we're going to exchange a GB of textures, so I need to do that myself if I can.
Thorsten
 
Posts: 11113
Joined: Mon Nov 02, 2009 8:33 am

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby galvedro » Wed Apr 30, 2014 7:58 am

The trick is this: The UV maps of the different objects do not cover 100% of the texture space. I leave a margin of about 0.5%. This margin is filled by repeating the last pixel in the image. Easier to understand with a picture:

Image

Look at how the left and inferior borders look. I did this within Blender by baking the textures so I can get very good precision, but it can also be done manually. What you would have to do is to resize the candidate texture so it is only about 99% of the final resolution and add a border to it like the one above (I will give you the exact numbers).

It shouldn't be too difficult to create a filter for Gimp to do the process automagically.

EDIT: typos and numbers
Last edited by galvedro on Wed Apr 30, 2014 1:41 pm, edited 1 time in total.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby galvedro » Wed Apr 30, 2014 1:37 pm

More details. When Blender creates that border, it also adds a progressive blur towards the edge of the texture, but I think that just propagating the last pixel should do the trick as well.

Important: I did the UV maps so they exclude a margin of 16 pixels in a 2048 px texture. If you want to create a 4096 pix texture, for example, then the margin should be 32 pix instead. Other sizes should honor this proportion appropriately.

You could do something like this in Gimp:

0. We start with a hires square image of whatever size.
1. Scale the image to 4096 - 2 x 32 = 4032 pix.
2. Extend the canvas to the full size (4096 x 4096), leaving the image exactly in the middle (Image->Canvas Size).
3. Add an alpha channel to the layer.
4. Extend the layer to cover the image size (Layer->Layer to Image Size)

5. Apply a value propagation filter (Filters->Distorts->Value Propagate). Set it up as follows:
    - Mode: more opaque
    - Check "to left" and "to right", leave top and down unchecked for now.
    - Check propagate alpha and value channels.
6. Repeat the filter several times (Ctrl-F) until you fill in the texture horizontally. Zoom in to the top left corner until you can see what you are doing, at higher resolutions it is difficult to see the margin.

7. Open the Value Propagate filter again (Ctrl-Shft-F), and now
    - check "to top" & "to bottom"
    - uncheck "to left" & "to right"
8. Apply the filter until you fill in the entire texture.
9. Remove the alpha channel.
10. Check for any artifacts and export.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby galvedro » Wed Apr 30, 2014 4:30 pm

Me again, sorry for the spam. :D

The cloud sphere is ready. I have also fine tuned all UV maps to be pixel perfect to the specs I gave in the post above. Let me know if you see anything wrong.

https://gitorious.org/fg/galvedros-fgdata/source/d4bb9ab10927a6e018ca54c78efcd13ed7047656:Models/Astro
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby Thorsten » Thu May 01, 2014 4:47 am

5. Apply a value propagation filter (Filters->Distorts->Value Propagate). Set it up as follows:
- Mode: more opaque
- Check "to left" and "to right", leave top and down unchecked for now.
- Check propagate alpha and value channels.
6. Repeat the filter several times (Ctrl-F) until you fill in the texture horizontally. Zoom in to the top left corner until you can see what you are doing, at higher resolutions it is difficult to see the margin.


There's something I'm not doing right here - trying to apply the filter, I just managed to screw up the texture sheet proper, but it didn't grow for even a pixel into the 'empty' border region.

(And for some completely unrelated reason I can't convert the clouds into dds - whenever I try, FG just shows a completely transparent texture. )
Thorsten
 
Posts: 11113
Joined: Mon Nov 02, 2009 8:33 am

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby galvedro » Thu May 01, 2014 7:26 am

Have you selected the "more opaque" mode of the filter? That should eat up transparency by copying the opaque pixels. If it doesn't, check that you either have the entire image selected (ctrl-a) or no selection at all.

Btw. Given that this process uses transparency for growing the texture, it won't work on the clouds as explained, but the seams will probably not bee as noticeable without the margins. Let me know if they are and we can think of another way to make it work.

Edit: ignore the comment on the clouds. The process will work as well, as long as you use the black and white images provided by Nasa. Only at the end of the process should the BW image be translated into transparency.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby Thorsten » Thu May 01, 2014 11:09 am

Okay, I realize what I had done wrong (selection...), but the process is not scalable to the large textures I'm interested in. For the full-res 16384x16384, the margin is 128 pixels, the filter seems to increment one pixel at a time, and at this resolution it runs for 45 seconds over the texture - which means that I'd sit for 4 hours menially pressing ctrl+F just to do one texture sheet, and I'd need 16 hours to do the whole thing.

*sigh*

Not sure what to do here. I'd accept some seams if I can get hires textures... but it seems it's basically not feasible to process them in a reasonable timeframe, so anything that large basically has to be used 'as is'.
Thorsten
 
Posts: 11113
Joined: Mon Nov 02, 2009 8:33 am

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby Hooray » Thu May 01, 2014 11:48 am

how much manual intervention is involved here ? GIMP can be scripted to a fairly high degree...
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11354
Joined: Tue Mar 25, 2008 8:40 am

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby AndersG » Thu May 01, 2014 11:53 am

As extending the outer rim is a fairly simple operation to program you could consider using ImageMagick to reduce the size of the original as desired and then write a small program to extend the rim data. With ImageMagick you can use the simple text-based PPM format as the intermediate format and then use ImageMagick to convert it back to the desired final format (PNG?). There may even be a ImageMagick filter that does exactly what you need - I haven't checked.
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2444
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby Thorsten » Thu May 01, 2014 1:14 pm

After some thinking, I have a suggestion. I'd like this to be accessible to whoever wants to render his own textures. And I'd like to have it look good in the official version.

galvedro, is this feasible: We ship per default the earthsphere with your uv mapping and textures with extended margins. We document the texture definition in the readme. We also ship an earthsphere with uv mapping for textures as they come from NASA. We document in the readme that this can alternatively be used for private texturing project, but will have smallish seams.

Does that sound like a plan?

I mean, even if I manage to script something in gimp / image magic (which I have never done and is going to take me a while to figure out) and even if that doesn't blow my memory (I regularly have to quit gimp and restart because I'm digging so deep into swap that the computer becomes unresponsive, I've had peak 14 GB memory usage at one point...), others won't be able to repeat the process easily.

So I see some merit in providing a simple okay solution and a more complicated perfect solution.

(The dds problem seems to be a bug of the plugin - I can create dds textures at 4096 and 16384 pixels resolution but not at the level between - odd, but that's what seems to be happening...)
Thorsten
 
Posts: 11113
Joined: Mon Nov 02, 2009 8:33 am

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby galvedro » Thu May 01, 2014 1:18 pm

Thorsten wrote in Thu May 01, 2014 11:09 am:Not sure what to do here. I'd accept some seams if I can get hires textures... but it seems it's basically not feasible to process them in a reasonable timeframe, so anything that large basically has to be used 'as is'.


A script is the way to go then. I outlined the process with out of the box tools in Gimp, but it is possible to write a small python script to do the job. Only the margin needs processing, so it should be way faster than the default filters, which are processing the entire image.

Gimp also has a batch mode, so it should be possible to throw all images and go do something else while Gimp is baking. This is assuming that Gimp doesn't crash... it doesn't handle large image files very gracefully unfortunately.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby galvedro » Thu May 01, 2014 4:25 pm

Thorsten wrote in Thu May 01, 2014 1:14 pm:galvedro, is this feasible: We ship per default the earthsphere with your uv mapping and textures with extended margins. We document the texture definition in the readme. We also ship an earthsphere with uv mapping for textures as they come from NASA. We document in the readme that this can alternatively be used for private texturing project, but will have smallish seams.

So I see some merit in providing a simple okay solution and a more complicated perfect solution.


Sounds good to me. I also think it is a good idea to make it accessible (that's why abandoned the inflatable cube approach). I will provide you then with another sphere, same geometry, but with straight uv maps.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: Earthview - an orbital terrain rendering engine [v0.1]

Postby Thorsten » Fri May 02, 2014 4:58 am

Some progress on the coding side - skydome parameters are now adjusted automatically as a function of altitude, getting the look'n'feel right otherwise is tricky. And (if cloud shadows are dropped) the cloudsphere can be rotated with respect to the earthsphere, in essence changing the weather at a location:

Image
Image
Image

@galvedro: I'm at home now over the 1st of May holiday where the internet connection is a bit lousy, but I'll merge what we have and push the newest edition to GIT some time next week.
Thorsten
 
Posts: 11113
Joined: Mon Nov 02, 2009 8:33 am

PreviousNext

Return to Spaceflight

Who is online

Users browsing this forum: AhrefsBot [Bot] and 1 guest