I always had problems understanding what a heightmap is and how to use it. I finally got a hang of it and I wrote a function that makes it more simple. I made an example for the function and commented the crap out of it. The function isn't amazing, but it does save some time. It seems more like a tutorial then anything else, but I figured someone might find use for it
.
Here is the function
function makeHeightMap(mId, heightmap, texture, mapSize, heightSize, segments)
make matrix mId, mapSize, mapSize, segments, segments
prepare matrix texture mId, texture, 1, 1
cls
paste image heightmap, 0, 0
modifier = heightSize / segments
for x = 0 to segments
for y = 0 to segments
pixelColor# = rgbr(point(x * modifier, y * modifier))
set matrix height 1, x, y, pixelColor#
next x
next y
update matrix 1
endfunction
and if you want to see an example of it download the attachment at the bottom. I hope someone here finds it useful.
[Edit] Blah, I forgot to add this to the title. This is for Dark Basic Pro u5.9 3. It should work on earlier versions, though I've only tested it on 5.7 and 5.9 [/edit]