PNG Heightmaps

DanielSefton

12-02-2009 23:39:35

Whenever I try to export a PNG heightmap, it never works and the terrain is flat. However, when I use PNGs generated by other people, including the heightmap supplied with Ogre, it works perfectly.

I've tried all sorts -- Photoshop, Fireworks, Paint.NET, The GIMP, 8-bit, 16-bit, 32-bit. Nothing.

Does PLSM require some sort of pure PNG format? I know each of these apps probably adds a lot of jargon to the file, but I'm not sure...

A while ago I did actually manage to do it with an 8-bit PNG, but I can't remember how exactly. Plus, 8-bit PNGs are really bad quality, and result in ugly 'peaks'.

What should the export settings be, and what applications have people used successfully?

Cheers.

DragonM

16-02-2009 22:47:08

Whenever I try to export a PNG heightmap, it never works and the terrain is flat. However, when I use PNGs generated by other people, including the heightmap supplied with Ogre, it works perfectly.

I've tried all sorts -- Photoshop, Fireworks, Paint.NET, The GIMP, 8-bit, 16-bit, 32-bit. Nothing.

Does PLSM require some sort of pure PNG format? I know each of these apps probably adds a lot of jargon to the file, but I'm not sure...

A while ago I did actually manage to do it with an 8-bit PNG, but I can't remember how exactly. Plus, 8-bit PNGs are really bad quality, and result in ugly 'peaks'.

What should the export settings be, and what applications have people used successfully?

Cheers.

I started with a 4097x4097 8 bit Terragen .RAW file and converted it to a PNG file using ImageMagick. There are Win32 command prompt binaries available, and most Linux distributions include it prepackaged. Use the convert tool as follows:
convert -size 4097x4097 -depth 8 gray:terrain.raw -type GrayScale terrain.pngArgument order is important. Of course modify the size parameter to match the size of the RAW file you start with, and modify the depth parameter if you save a 16 bit RAW file instead of 8 bit. PLSM evidently does require an extremely correct form of a PNG file. The magic that finally got it in a form that mapsplitter could deal with was the "-type GrayScale" parameter. Without it, mapsplitter's processing of the input file resulted in useless flatness.

I was unable to get mapsplitter to handle the RAW file directly.

DM

Leron

05-03-2009 08:48:22

how can i convert colormap png to heightmap with imagemagic? I had the same problem as DanielSefton.
convert -size 2048x2048 -depth 8 gray:ps_height_1k.png terrain.png
I tried this command and get file with noise.

DragonM

06-03-2009 05:01:16

how can i convert colormap png to heightmap with imagemagic? I had the same problem as DanielSefton.
convert -size 2048x2048 -depth 8 gray:ps_height_1k.png terrain.png
I tried this command and get file with noise.

If by colormap png you mean a 24 or 32 bit png file, you should omit the "gray:" prefix on your input filename. You do still need to include the "-type GrayScale" parameter. Before you begin, you should also modify your image to be 2049x2049. PLSM2 requires heightfields that are (2^n)+1 pixels. You should be able to omit the -size parameter entirely. It's only necessary when processing a RAW input file. PNG format has unambiguous dimension encoding.

A command line like this should work, after sizing to 2049x2049:
convert ps_height_1k.png -depth 8 -type GrayScale terrain.png

DM

------
Edit: I was misremembering size restrictions. Ogre's own default terrain manager requires textures that are 2^n+1 pixels. PLSM2 does not.