Jump to content

Terrain RAW I/O

Recommended Posts

In case anyone wants to edit their terrain outside of Leadwerks, I found the ImageMagick tools do a pretty good job of converting it.


In my case I want to convert my 256x256 Leadwerks terrain to something I can work with in Blender. Note, if your terrain is a different size, you will need to specify that in the following commands.


To convert the leadwerks .raw file I output using the 'Export' function under the Terrain tab (I did not try .r16, not sure if thats different) to .exr format, I used the following command:


convert -interlace none -size 256x256 -depth 16 -endian lsb gray:/path/to/leadwerks.raw /path/to/map.exr


You can then edit the exr file in another app, and when you want to get it back into leadwerks you can run:


convert /path/to/map.exr -depth 16 -endian lsb gray:path/to/leadwerks.raw


You can reimport it using the 'Import' button in the terrain tab.


To view the raw image file, you can use the 'display' command from ImageMagick.


display -size 256x256 -depth 16 -endian lsb gray:/path/to/leadwerks.raw

Share this post

Link to post

And another tip - should you wish to 'expand' your terrain, e.g. create a small area and then embed that in the center of a large area, so your level extends further, you can resize the terrain 'canvas' e.g. to place a 256x256 terrain heightfield into the middle of a 512x512 area:


convert /path/to/map.exr -interlace none -depth 16 -endian LSB -gravity center -extent 512x512  gray:/path/to/leadwerks.raw

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...