Mesh Terrain to 8bit Height Map

Blitz3D Forums/Blitz3D Programming/Mesh Terrain to 8bit Height Map

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

or,

img=CreateImage(TerrainSize(t),TerrainSize(t))
SetBuffer ImageBuffer(img)
LockBuffer
For x=0 To TerrainSize(t)-1
	For z=0 To TerrainSize(t)-1
		c=TerrainHeight(t,x,z)*255
		c=(c Shl 16)
		;blitz only uses the red channel for heightmaps, but if you want greys, uncomment the next line
		;c=(c Shl 16)+(c shl 8)+c
		WritePixelFast x,TerrainSize()-z,c
	Next
Next
UnlockBuffer
SetBuffer BackBuffer()


that should work.