; ID: 1207 ; Author: TetraHC ; Date: 2004-11-26 16:07:27 ; Title: Normal Map ; Description: Generates a simple normal map from a height map for use with Dot3 AppTitle "NormalMap" Graphics 800,600,32,2 ; this is a grayscale image. Each pixel is height information. ; White being the heighest and black being the lowest. ; you can use a color image but only the blue channel is used heightmap = LoadImage("heightmap.bmp") Global img_w = ImageWidth(heightmap)-1 Global img_h = ImageHeight(heightmap)-1 lightmap = CreateImage(img_w+1,img_h+1) LockBuffer ImageBuffer(heightmap) LockBuffer ImageBuffer(lightmap) For y = 0 To img_h If y>0 : ym1=y-1 : Else : ym1=0 : EndIf If y0 : xm1=x-1 : Else : xm1=0 : EndIf If x