3d 3D Resources and Applications 3Deditortests 3dmodeling 3dmodelling 3dprinting 3dterrain abobe illustrator AC3D academic accessibility Addon adobeillustrator Adoboe aeontimeline amigaOS anamorphic android Android animation annoyances Anxiety apple application Application References ApplicationReferences Applications apps AprilUpdate Archie] archives art ascii-art assistants astronomy Australia AutoRun b3d BBCNews blender Blender Blinded by Science! BlindedbyScience braille Brave BSD c128 c64 Centric chemistry Chrome chromeOS Clipstudio coding comic ComicNarrative comics commodore Computer Madness ComputerMadess ComputerMadness computers ConEmu console Consoles contours Copernicus Daria daylonleveller design designer diagrams digitalcomics digitalpainting digitaltag discovery_of_pulsars DIY docear doctorwho DOD drawing drawingsoftware drwho dualboot Earth ebooksfree ecosystems Edge Edit editing editors emailclient endniote Engineer excel exegesis exporting facebook facebooksucks Fault fileutility firefox Firefox firefox57 Firestorm flash free freeBSD freemium freeplane freesoftware freeware Friendica Galileo generator Geocentric geos Ghost World GIF github google+ googleplus googleplussearch googleplustips graphics GRUB gui harddrive HarrissSpiral hashtag hashtags heightfield Heliocentric help HighandLowWeirdness history_of_science HistoryOfScience HomeNetwork import importing infographic interactivestory Intermittent internet Internet Stuff InternetStuff INternetStuff iOS IOS ipad iphone ironman ISurfSocial java javascript Jenny Everywhere JocelynBellBurnell Knowhow kodi krita Krita LAS LASOpensimulator LASRandom LASTechnology Laura Ess Laura's Art LauraEss leveller Libraries libreoffice linux Linux LinuxSnap LiveJournal mac macOS MacOS macOSX mangastudio5 mangastudioex5 maps MapSCII math mathart mathematics MaxOSX MediaPC memorial mesh MeWe microsoft microsoftexcel mindmapping mindmaps Mint MintKDE modelrailways mono mozilla Mozilla MSNFeed Music NAS nasa natron NBN ncp NetNeutrality netradio Network NetworkStorage newzealand NikolaTesla nodejs npm NUC nz online onthisday open opensim opensimulator opensimulator terrain OpensimulatorLAS opensource opensourcesoftware openstreetmap Opera opml Orbit os outliner PaintToolSai PanicAttack password penrosetriangle pets photoorganizer photoshop physics Physics Planets plant plants png Podcast polyhedron Privacy processing projectmanagement PSRB1919 publicdomain pyromagnetic_electric_generator Q4OS quantum_mechanics RandomLAS raspberrypi recovery RecRoomPC research Safari Sai SAVENETNEUTRALITY scalextric scapple science scienceeveryday ScienceGIF Scooby Do ScoobyDoo screencapture Scrivener search searching SecondLife secondsgrid SecurityBreach server shapes sharing shopping simonastick Singularity sketchup smartphone SocialMedia software Solar SolarSystem sound sounds space startrek steampunk strawhouse StudioPC subscription sweethome3d Synology tablet tags taskmanagement Technology TechnologyLAS terrain texteditors TextFormatting textures TheFederation thunderbird todolist Tor trees TripleJ trolley tutorial twt UI universe update updates USA USB3 utility vector-tiles vectoreditor vectors vfx video videoediting videorecording viewer vintagecomputing Vivaldi web Web webbrowser webcam webdevelopment werner_heisenberg Widows Win10 Win10Install win7 Win7 windows Windows Windows10 Windows64 windows7 WindowsUpdate Wings3D WomensDay worldmap XnViewMP xport

Wednesday, March 8, 2017

Leveller for Open Simulator (part 5)

Merging Documents in Leveller

This tutorial looks at merging two terrains using Leveller (a powerful 3D terrain editor for windows from Daylon Graphics) for later use in OpenSimulator (Opensim). This tutorial assumes that you've read Part 4. If you haven't, please do that before reading on.

We'll be using to generate 16bit PNG terrain files for us. This online application allows the user to select a portion of the map of the earth and generate a series of PNG files that you can import into Leveller. The reasons for using this online application are:
  • It's free to use;
  • PNG format can be viewed as an image;
  • Files can be generated from anywhere on the Earth ; and
  • It's simple to use.
Now has a couple of quirks as well. All water.sea area is set to zero height, so there's no height information beyond the coastline. Also the selection square used can only range between 8km to 60km. That means that there's a limit to how fine the detail is, and if you want to model anything bigger, you have to create several downloads and patch the heightfields together. The window looks like:

You can search by name for a location, zoom in or out, and scroll around the map of the Earth by dragging the mouse. You can also decide which which overlay to use, though the two USGS options only work in the USA and territories. You can also decide how large the selection area is and place that where you want, though it doesn't move unless either you manually move it, or your text search moves the map to a location.

Tenerife Island

Tenerife Island was used an an example of creating contours with shapes in Part 3. Here's a map of it...

By Oona Räisänen (Mysid) - Self-made in Inkscape.Topographic data from the Shuttle Radar Topography Mission (SRTM) as modified by CGIAR-CSI.Bathymetric data from SRTM30_PLUS.Relief shading was derived from SRTM data in GIMP.Roads and place names manually retraced from the OpenStreetMap, originally by OpenStreetMap contributors., CC BY-SA 3.0,
...and here's an view of it from space:

The main difference between this and the previous two examples in Part 4, is that the island is too large to fit into the largest selection size of which is 60km. Now one solution to this issue would to find a different source of map data for the island. For this example however, we'll do a work around, of patching together the heightfields from two overlapping PNGs.

To do this, first we'll expand the selection area to 60km and download from first the South West of Tenerife, and then from the North East. There should be an overlap as seen below:

The two selections above are (as taken from the Readme files of each downloaded zip:
Tenerife 60km SW,28.468774,-16.968654,27.929788

Elevation range: 0 through 3696 meters 
Tenerife 60km NE,28.768499,-16.639940,28.229514
Elevation range: 0 through 3616 meters

The maximum heightfields vary because one of the maps has height terrain than the other. The scale for each is 1081 / 60000 or 0.0180166666666667 or 2%! We can scale the maximum heightfields down proportionally to 73.92 for Tenerife 60km SW, and 72.32 for Tenerife 60km NE.

Going through the process that we did for both St. Helena and Rottnest, after inspection well use the Merged versions of the PNGs for each: Tenerife 60km SW Height Map (Merged).png and Tenerife 60km NE Height Map (Merged).png. We'll import each with correct elevation ranges, accept the large map, and select ALL of it. We then have two maps:

Each of these documents is 1081×1081 in size, and their heightfields should be correctly scaled so that when we paste them together, there should be a smooth join. The guidelines on each have been changed to show only 1m and 256m, and the difference in what shows depends on what zoom you have. Before we do anything else, we'll save these documents with their default names as Import of Tenerife 60km SW Height Map (Merged).ter and Import of Tenerife 60km NE Height Map (Merged).ter!

 Merging maps

There are two ways to merge these two documents together. The first is to enlarge one of the documents by using Edit > Pad and then copy and paste the terrain of the other document into it. You could also create a new document using File > New and make sure it has enough width and breadth, and then copy and paste both documents into it. In either case, In the first case I'd recommend saving a copy of the padded document with a new name via File > Save As, so that if anything goes wrong, you still have an original version of that document if anything goes wrong.

We'll do the padding option in this example, and use Import of Tenerife 60km SW Height Map (Merged).ter as the document to be padded. Doing Edit > Pad (or Shift + E) with that document selected brings up...

We should select the bottom left box because that's roughly where that document's terrain will sit in the final merge. This will mean that no pixels will be added to the left or bottom of the document. The next question is how much to expand the document? We could just play save and double the Width and Breadth, and crop the document later. Looking at the maps above, there should be about an extra 512px to both dimensions. If we add 600px that gives a margin or error. Either way we may need to crop or pad the document afterwards, to make a document width dimensions evenly divisible by 256m, and hence suitable for export to Opensim. The help page on this dialog says to ...check Also enlarge the coordinate system's extents if you want the ground extents to increase to take into account the new areas. This will preserve gridpost spacing. Otherwise, gridpost spacing will decrease since more heightfield pixels are using the extents. Normally you'll want to enlarge the extents as this will preserve the spatial measures of heightfield formations. Seems like a good idea. So we'll try this:

...and this is the result:

So far so goo. Now would be a good time to Files > Save As this to something like Tenerife (Merged Terrain).ter. Now we swap to Import of Tenerife 60km NE Height Map (Merged).ter and do a Selection > Select Elevations. If we enter -11 to 0 in the following dialog...

...and the select Replace and OK the that on the following dialogue (if it appears), we get the following selection:

Everything but the land is selected. If we use Selection > Invert (or Ctrl + I) we invert the selection and get this...

...which is the selection we want. Now we use Edit > Copy (or Ctrl + C) on this selection and then swap to the padded document. After doing Edit > Paste (or Ctrl + V) we should see this:

The selection's been pasted to the padded document, and the Select tool is now active. This is currently a Floating Selection, so you can move it about first, and when happy with the position, Defoat it to be part of the terrain below. Until you defloat this, you can still press Delete and erase the selection if you want to (maybe you realised you've copied the wrong selection). Using the scroll wheel on your mouse will zoom in and out on the map, which is handy for matching up terrain.

This looks about right, so we'll use Selection > Defloat > Replace, which will replace the terrain underneath with the floating selection. The result is...

...which is not quite right! What's with the dark lines? Looking at the scene, we see:

Oops, the terrain looks slightly off, and the lines are showing the edge of the paste where the heights don't match. We have several options. We could do an Edit > Regress To to restore the map to the previous state, and return the floating selection. e.g.:

Instead of using the mouse to move the floating section, you can just use the arrow keys to move it one pixel at a time (though you need to time this correctly or you'll overshoot). It may just mean you need to move the floating selection a few pixels horizontally or vertically. If the next attempt doesn't work you can regress and try again. It could be that our scaling is slightly out as well, and you could try importing the PNG again with a slightly lower maximum height.

You can also choose other options than Replace when defloating the selection. Use Edit > Regress To as shown above, but when you Defloat the selection you might try Average instead. This will be fine when defloating over similar parts of the map, but defloating over zero or blank areas, not so much. Another option is to play around with the selection before you copy it. Try doing Selection > Shrink four times and then Selection > Feather with 4px. Or you can Selection > Blur it as well. Then when pasting a slightly smoother edge might result.

Alternatively you could Regress as above, swap to the other map and use Filter > Elevate  with Lower and 1, and then copy the altered selection. If the paste is 1px out in elevation, this might be an easier way to change that.

Or it might not. In the end you might just need to use the Blur tool and Smudge tool to soften the edges manually. Of course that's going to reduce accuracy in relation to the real world terrain, but if you can't see the creases it's all good. Here's the result of some blurring and smudging. There's a hint of line, so some more work needs to be done.

Assuming that's done, we still have some cleaning up to do. Here's what the whole map looks like, with the Contours toggled off:

The padded area has a height of -18, and the original no data (ocean is zero). You need to make this standard. Easy to do using the Magic wand tool. Select some part of the padded area, and then select some of the zeroed are while pressing Shift. That selects everything that isn't the island:

You could also do a Selection > Select Elevations and use .1 and 400 as values. That will select everything over zero. Then press Ctrl + I to invert the selection and we get the same result. Either way, if we press Delete then all the selected area becomes -18.

Finally we'll use Filter > Elevate using Lower and 2 to drop everything by 2m, with the ocean floor being at -20 (the lowest you want for most documents getting exported to Opensim. It now looks like:

Looking better, and a lot better than my result in Part 3!

No comments:

Post a Comment