heightmap textures

Blitz3D Forums/Blitz3D Programming/heightmap textures

Sorry Eviltoes I'll see if I can explain it a bit better.

I assume you have a heightmap (bitmap) you are using for the terrain using the loadterrain("heightmap.bmp") command.

The diffuse map is simply your colored,textured bitmap that you want to apply to the terrain. For the purposes of this exercise you could use any bitmap you want.

To scale the texture use the 'scaletexture' command.

Here is some sample code to test it with:

Graphics3D 800,600,32,2


camera=CreateCamera()
MoveEntity camera,0,100,0

terrain=LoadTerrain("heightmap.bmp") ;image you want for heightmap
tex=LoadTexture("colormap.bmp") ;image you want for texture

EntityTexture terrain,tex
ScaleTexture tex,256,256 ;assumes image for texture is 256pixels by 256pixels.  You may need to use the texturewidth(),textureheight() commands for arbitrary texture sizes



Repeat


If KeyDown(200) Then MoveEntity camera,0,0,1
If KeyDown(208) Then MoveEntity camera,0,0,-1
If KeyDown(203) Then TurnEntity camera,0,1,0
If KeyDown(205) Then TurnEntity camera,0,-1,0

UpdateWorld
RenderWorld
Flip



Until KeyDown(1)
End