Do not use images for heightfields!
Posted: Thu Jun 28, 2007 6:09 am
Hi all,
The issue of steps in heightfields has popped up a few times, so I thought I'd post a sticky to address this properly and (hopefully) finally. Here are a few facts to bear in mind:
Are there any questions?
Cheers,
Aaron.
The issue of steps in heightfields has popped up a few times, so I thought I'd post a sticky to address this properly and (hopefully) finally. Here are a few facts to bear in mind:
- The steps are caused by converting the heightfield to or from an 8-bit format (these can only encode 256 levels, which aren't enough).
- Most image formats use 8-bit colour depth. PNG-16 and some TIF formats are the exception (these are OK).
- Even 24-bit or 32-bit true-colour bitmaps and JPEGs use 8-bit colour depth.
- Creating or editing your heightmap in an image editor will produce these 8-bit steps, because image editors work on 8-bit colour depths. This happens even if the input/output file formats are 16-bits or higher (note: Photoshop has very limited 16-bit support, and other programs usually have none).
- You cannot remove these 8-bit steps, unless you blur/filter your map in a program that supports 16-bit height precision or greater (L3DT uses 32-bit precision).
- Re-saving in 16-bit formats does not remove these artefacts.
- If your heightmap has at any point been created/edited in an image editor, or converted to/from an format with 8-bit colour depth, you will have introduced 8-bit steps.
Are there any questions?
Cheers,
Aaron.