L3DT users' community
Large 3D terrain generator

Exporting to OpenSim

Got a problem or need advice?

Exporting to OpenSim

Postby LauraEss1957 » Mon Mar 21, 2016 4:54 am

I've been using LT3D to make terrains for my stand-alone OpenSimulator(OS) grid, which I will be using for "shoots" in a webcomic I make.

ImageBuggle Islands overview

The sims (individual square sections of the grid) are not 256x256 m as they are in the default, but 768x768 instead, as I wanted to have a large area within which to create permanent sets to shoot the webcomic in.

Image
4x4 sim or 3072x3072m map of Urbania

Of course OS, which is the open source version of Second Life(SL), has its own methods of generating terrain cover (you get four zones/textures per sim, with coverage based on height), so really I'm using LT3D to sculpt the heightfield. I think I've got the basics right. The horizontal scale is 1m but I suspect I'm getting mixed up abbout both sea levels and the vertical scale. In OpenSimulator the default water level is 20m, and I know I can set this the same in LT3D, but when I import a heightfield I've exported from LT3D it always seems magnified in height!

I'm clearly missing something obvious here, but what? I'd rather have what I see in LT3D match up in OpenSimulator. The two formats I can export with for OS are r32 and PNG. Does it make a difference if I use one over the other? Is there a setting I'm missing in LT3D related to height scale?

The other thing is that I can do "post-import modifications" in OS. The console has the following commands...

Code: Select all
terrain elevate x   - raises the terrain in the sim by x metres
terrain lower x     - lowers the terrain in the sim by x metres
terrain multiply x  - multiplies the terrain values by x


...so if I knew why the heightmap was multiplied and how much, I could adjust it back to what I want it to be by a number of steps, but I need to know how to judge that.

Suggestions please.




UPDATE: I think I will do some tests on dummy terrains created in OS and imported to LT3D, and then exported back into OS, and post the results here. It makes sense to show what I mean by "magnified" in detail. Will post that this afternoon.
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia

Re: Exporting to OpenSim

Postby LauraEss1957 » Tue Mar 22, 2016 5:27 am

OK, here's the test of importing into OpenSimulator from LT3D. The blue arrow in the images below points North/Up in either LT3D or OS.

First, this is the 3D view within LT3D. I manually set the water level to 19, and the heights were set exactly using the Set to tool:

Image

This is the resulting Heightfield:

Image

I exported this twice, once to r32 format, and once to png format. Below is the result of using terrain load "P:\(COMMON)\IMAGES (Media)\(IN)\Mock-ups\LT3D\HF Export.r32":

Image

The levels seem correct, but if you look at the arrow the import "mirrored" so that South becomes North! I cleared the sim with a terrain fill 1 command (which sets the sim height to a flat 1m) and then loaded the PNG version
using terrain load "P:\(COMMON)\IMAGES (Media)\(IN)\Mock-ups\LT3D\HF Export.png":

Image

This is the same viewpoint as the R32 image. You can't see that much but the elevation is still loaded in the South/Bottom side of the sim. If we change the viewpoint to North to South (similar to the view on the LT3D edit) we see:

Image

The image has loaded in the correct orientation, but the heights are distorted. So, roughly, because the height was measured from the avatar's position, we get these differences:

Image

So, the r32 correctly imports the height values, but mirrors North to South, and the PNG doesn't mirror those but multiplies the values by about 1.65. I may have solved my own issue here because provided I do a terrain multiply 1.65 command for the sim in the console afterwards it should be what I designed in LT3D. :)


But, why would the r32 image flip like that? If I could fix that I would simply export to r32 every time.
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia

Re: Exporting to OpenSim

Postby Aaron » Tue Mar 22, 2016 7:52 am

Hi LauraEss1957,

Welcome to the forum, and thank you for the detailed questions.

The PNG exporter scales the output to span the entire bit depth of the image. For 8-bit PNGs, the images are scaled such that the lowest height is 0, and the highest height is 255. For 16-bit PNGs, the values span from 0 to 65535. This means that the multiplier is not a constant; it depends on the altitude range of the heightfield. RAW32 is unscaled, since it stores floating point numbers. The other integer-based RAW formats are scaled, just like PNG, as are all image formats.

As for the flip of the Y axis, 'that's a feature, not a bug'. L3DT has the origin (x=0,y=0) at the southwest corner of the map, which matches various scientific and cartographic conventions, but does not agree with many programs. You can flip the Y axis of the exported file to match the origin-at-northwest convention by clicking on the 'options' button in the export wizard, and setting the 'InvertY' flag to true. For more information, please see the Why is the y-axis inverted in my map file?' FAQ.


Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting to OpenSim

Postby LauraEss1957 » Tue Mar 22, 2016 9:20 am

Ah, that means then that r32 is the format to use, and avoid png! And it seems I only need to set that option once under File Formats dialog box. This makes things so much easier. Thanks! :)

Just in case someone else is using open simulator has the same problem and reads this I'll just to an experiment to confirm this (I don't doubt you but empiricism can be fun).

First I'll create a blank design map and then draw a crude arrow on the heightmap like...

Image

Then I'll go to FILE > FORMAT PREFERENCES and change the setting for r32 to...

Image

...so that InvertY is false. Then I export the heightmap in r32 format to a suitable filename. To confirm I can run my OS grid, select the region and then do a terrain load to load the r32 file. I get this...

Image

...which is the same orientation as on the Heightfield map in LT3D. And it works both ways, so i can do fidley corrections in OS, and then export it back. And if I don't want to permanently change the r32 format settings, I can still do it on the fly using OPTIONS as per below.

Image

Brilliant! This is going to make things really smooth.
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia

Re: Exporting to OpenSim

Postby Aaron » Tue Mar 22, 2016 12:00 pm

HI LauraEss1957,

Is all you need for OpenSim a RAW32 (with InvertY off), with the heights adjusted so that the water level is at 20m? If so, I could easily bake that into a nice exporter plugin / script. Please let me know if you require any additional data.

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting to OpenSim

Postby LauraEss1957 » Tue Mar 22, 2016 11:48 pm

Aaron wrote:HI LauraEss1957,

Is all you need for OpenSim a RAW32 (with InvertY off), with the heights adjusted so that the water level is at 20m? If so, I could easily bake that into a nice exporter plugin / script. Please let me know if you require any additional data.


That would be great! I'm sure I'm not the first OpenSimulator User to use LT3D and I won't be the last. A dedicated plugin would be so much simpler.

The water levels in OpenSimulator are set by individual region. The default is 20m for any new regions created but I have seen regions where it's less and also more. Whereas Second Life (not counting the Beta grid for experimenting) is all one grid OpenSimulator has what's know as The Hypergrid, which consists of separate grids run by different groups and people, but accessible by "teleporting" avatars between them. That means each grid, or region in a grid, might have different water settings depending upon the function of that grid or individual region. In a a set of desert regions (meant to be like Arrakis from Dune) the water level was 0, and in another grid with a region which had no coastline and was a high alpine area, I saw a higher setting of 45 so as to create an internal lake (otherwise the lake is "faked" by a phantom prim). Likewise a grid specialising in deep water scenarios - say for Steampunk nautical roleplaying - might also have a higher water setting.

If you were to create a plugin, it would be better to have a default of 20 which the user could change. In most cases the water levels affect the outlines of islands and it probably wouldn't change from 20 at all. OpenSimulator also goes into negative height values, but anything below zero gets very dark and murky.
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia

Re: Exporting to OpenSim

Postby Aaron » Wed Mar 23, 2016 2:01 pm

Hi LauraEss1957,

I've uploaded L3DT 16.03 release candidate 1 to the Pro downloads page (see your sales/registration receipt e-mail), which includes the first draft of the new OpenSim exporter plugin. The menu option is 'File->Export->Export to OpenSim'. The export window allows you to set the sea level, which in effect moves the elevation of all points up by the value you specify. For reasons of paranoia, I have included a checkbox for 'Invert Y', but this can be removed later if the default value (false) is OK. The settings are automatically saved & recalled each time you use the exporter, except for the filename, which you are asked for each time. Please also note that if you select an area of the heightmap using the 'Edit->Select area' window or the 'Tools->Select area' mouse tool, the exporter will export just the area you select as the r32 file (this may be useful for making a number of grids in one L3DT project).

Please let me know if you find any problems with the exporter or the new release candidate, or if you have any suggestions for changes.

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting to OpenSim

Postby LauraEss1957 » Wed Mar 23, 2016 8:49 pm

Thank you. I'll test this later today.
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia

Issues with L3DT 16.03 release candidate 1

Postby LauraEss1957 » Thu Mar 24, 2016 11:13 pm

OK, I downloaded and installed this. I created a new project 768x768 in size by using the designable map option, and I used a 0 setting for water (sea) which created the following Water map (with the water areas being zeo or less on the heightmap):

Image

I then went to FILE > EXPORT > EXPORT TO OPEN SIM. The Windows SAVE AS dialog appeared with the last save directory chosen (\\Media-win7\(common)\IMAGES (Media)\(IN)\Mock-ups\LT3D as I'm saving to a network drive) and a default name of Plugin Test_HF.r32 (Plugin Test being the name of my test project). I select SAVE AS and get the following dialog box.

Image

I select OK, and it goes back to the Windows SAVE AS dialog box. If I select SAVE on this focus goes back to the dialog above, and I get stuck in a loop between the two dialogs, and can't save the file. I tried closing the above dialog box while the SAVE dialog was still open, but it then opened a NEW Export to OpenSim dialog, and didn't close the SAVE dialog.

Image

Probably an error in code here. You probably don't need the first SAVE AS dialog box as it's an export. Just noticed a couple of network drives were offline in the above screenshot, but I tried doing this with them online a couple of times with the same result.

I noticed there's no IMPORT equivalent yet, which is fair enough, since you'd want to get the export plugin working first. Oh, I also tried creating a project heightfield by importing an r32 file and it crashed LT3D!
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia

Re: Exporting to OpenSim

Postby Aaron » Sun Mar 27, 2016 1:07 pm

Hi LauraEss1957,

I apologise for that fault with the file export window. The exporter didn't recognise a network drive as an absolute path, so it kept opening the file dialog to ask for an absolute path. I have fixed this for the next release, which should be available within a day or two.

Oh, I also tried creating a project heightfield by importing an r32 file and it crashed LT3D!


Hmmm...I just tested it and I can't seem to make it crash. What settings did you use on the r32 import? Since raw files don't store their size, the user has to manually input the width and height in pixels, the bit depth, and the header offset (which should be zero). If these settings were wrong, it could crash L3DT, although I have been unable to reproduce this. For the next release I have added some sanity checking to make sure the entered settings agree with the RAW file size. If problems persist, please send an example r32 file to aaron@bundysoft.com for debugging.

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting to OpenSim

Postby LauraEss1957 » Mon Mar 28, 2016 10:53 pm

I just downloaded and tested the revised program and it works fine.

I created a 512x512 project with this as a water map:

Image

After importing to OpenSimulator it matched exactly:

Image

Very smooth indeed. :) Is there a command I can use on the whole height to adjust it up or down a set number of metres? When I re-imported the r32 file the resulting heightmap was 20m too tall!

Image


Also, I've tried to replicate the error I had with importing a heightmap but it works fine now, which is all good.
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia

Re: Exporting to OpenSim

Postby Aaron » Tue Mar 29, 2016 6:47 am

Hi LauraEss1957,

LauraEss1957 wrote:Is there a command I can use on the whole height to adjust it up or down a set number of metres? When I re-imported the r32 file the resulting heightmap was 20m too tall!


Yes, 'Operations->Heightfield->Change vertical range'. Reduce the value in the 'average altitude (m)' field by 20. When I make the equivalent importer, I'll be sure to subtract the sea level value automatically.

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting to OpenSim

Postby LauraEss1957 » Mon Feb 06, 2017 8:44 am

Well I just discovered that OpenSimulator can import Terragen heightfields! This is only mentioned in one place, and ever other tutorial I've ever read only mentions .r32 files! This might streamline workflow a bit.
User avatar
LauraEss1957
Contributing member
 
Posts: 32
Joined: Mon Mar 21, 2016 3:31 am
Location: Hunter Valley, Australia


Return to Help and support

Who is online

Users browsing this forum: No registered users and 10 guests

cron