L3DT users' community
Large 3D terrain generator

Invert Height map?

Got a problem or need advice?

Invert Height map?

Postby TorQueMoD » Wed Feb 23, 2011 1:15 am

Hey guys!
I tried searching around the forums here for the answer to my subject but wasn't able to find anything.

Does the program have a feature to invert the current height map? I tried exporting a bitmap, inverting it in Photoshop and then re-importing but after PS saves the file it won't import back into L3DT anymore.

Thanks!
TorQueMoD
New member
 
Posts: 3
Joined: Wed Feb 23, 2011 12:35 am

Re: Invert Height map?

Postby Aaron » Wed Feb 23, 2011 12:17 pm

Hi TorQueMoD,

The traditional way to invert the heightfield in L3DT is to select the 'Operations->Heightfield->Change vertical range' menu option, and swap the values in the min. alt. and max. alt. fields.

I've added a script to the the next developmental build to invert the heightfield via a couple of mouse clicks.

By the way, can you tell me what error L3DT threw when you tried to load the bitmap from PS? I'm not aware of any incompatibilities with the bitmap plugin, so it would be useful to see the error log from this event.

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

Re: Invert Height map?

Postby Telarus » Thu Feb 24, 2011 5:13 am

I get the .bmp error as well (I've taken to using png for import, mostly).

A 24bit rgb .bmp (256 * 256px... I rendered 'clouds' in PS with full black and full white, so it's just shades of grey) gives this error:

Code: Select all
L3DTio_BigBitmap::LoadMapFile error:
 - bitmap data size mismatch (196610 reported, 196608 expected)

CMapGroup::LoadMapFile2 error
 - error loading file



After converting to 8bit greyscale .bmp, I get this error:

Code: Select all
L3DTio_BigBitmap::LoadMapFile error:
 - bitmap data size mismatch (65538 reported, 65536 expected)

CMapGroup::LoadMapFile2 error
 - error loading file
Telarus
Doyen
 
Posts: 112
Joined: Mon Jun 01, 2009 12:34 am

Re: Invert Height map?

Postby TorQueMoD » Thu Feb 24, 2011 5:34 am

Yes, that's the same error I got but the numbers were obviously different. I'll try a PNG next time.

Thanks Aaron.
TorQueMoD
New member
 
Posts: 3
Joined: Wed Feb 23, 2011 12:35 am

Re: Invert Height map?

Postby Aaron » Thu Feb 24, 2011 11:32 am

Hi Guys,

Thanks for the bug report. I tested the bitmap importer/exporter against 8- and 24-bit bitmaps from the GIMP, Paint.NET and MS Paint, and it worked in each case. However, I don't use don't use PhotoShop, so I've not had the opportunity to test the bitmap plugin against PS exports. From the error log it looks like Photoshop is padding with an additional two bytes. By pulling apart the example file I should be able to work out what they're doing differently and update the importer accordingly. Could I ask you to please send me an example PS bitmap for testing? Preferably a small one that won't load in L3DT. Zipped, if you please, and sent to aaron@bundysoft.com. Ta.

Best regards,
Aaron.

PS: As a general rule, I strongly recommend against using image formats to store heightfield data. In particular, 8-bit and 24/32-bit images have only 256 possible greyscale values, and this quantisation will introduce nasty terraces in your map. 16-bit greyscale formats are better (PNG, RAW), and if you must use an image format then these are the ones to go for, but they nonetheless drop the altitude & horizontal scaling data out of the file (as all image formats do, except GeoTIFF). Furthermore, editing these images in an image editor in 8- or 24/32-bit modes will also bake the terraces into the heightmap, regardless of what file formats you use. Ah, but now I'm sounding like a broken record.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Invert Height map?

Postby Telarus » Thu Feb 24, 2011 8:57 pm

Send you the 2 files I used for the above errors.
Telarus
Doyen
 
Posts: 112
Joined: Mon Jun 01, 2009 12:34 am

Re: Invert Height map?

Postby Aaron » Thu Feb 24, 2011 9:51 pm

Hi Telarus,

Thanks for the files. PhotoShop was padding the end of the data section with zeros, so I've modified the plugin to accept files that have such padding. The updated plugin will be included in the next developmental build, and I'll post back here when it's available.

Thanks again for reporting this bug.

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

Re: Invert Height map?

Postby Aaron » Tue Mar 01, 2011 12:39 pm

Hi Telarus,

The updated bitmap plugin has been included with L3DT v2.9 build 11, which is on the downloads page now. Please let me know if you find any problems with it.

Oh yes, and as to inverting the heightfield, this latest build also includes a nice new 'Operations->Heightfield' menu option.

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


Return to Help and support

Who is online

Users browsing this forum: No registered users and 7 guests

cron