This bit of code can be used to smooth the jaggedy lightmaps produced by the Lite version of DeleD.
copy file "new scene_LightMap0.bmp","new scene_LightMap0_temp.bmp"
delete file "new scene_LightMap0.bmp"
load image "new scene_LightMap0_temp.bmp",1
make memblock from image 1,1
make memblock from image 2,1
for xt=0 to 15
for yt=0 to 15
for x=1 to 30
for y=1 to 30
px=x+(xt*32)
py=y+(yt*32)
a#=(ReadFromImageMemblock(1,512,512,px,py))
px=(x-1)+(xt*32)
py=(y-1)+(yt*32)
b#=(ReadFromImageMemblock(1,512,512,px,py))
px=(x-1)+(xt*32)
py=y+(yt*32)
c#=(ReadFromImageMemblock(1,512,512,px,py))
px=(x-1)+(xt*32)
py=(y+1)+(yt*32)
d#=(ReadFromImageMemblock(1,512,512,px,py))
px=x+(xt*32)
py=(y-1)+(yt*32)
e#=(ReadFromImageMemblock(1,512,512,px,py))
px=(x+1)+(xt*32)
py=(y-1)+(yt*32)
f#=(ReadFromImageMemblock(1,512,512,px,py))
px=x+(xt*32)
py=(y+1)+(yt*32)
g#=(ReadFromImageMemblock(1,512,512,px,py))
px=(x+1)+(xt*32)
py=y+(yt*32)
h#=(ReadFromImageMemblock(1,512,512,px,py))
px=(x+1)+(xt*32)
py=(y+1)+(yt*32)
i#=(ReadFromImageMemblock(1,512,512,px,py))
avr#=(rgbr(a#)+rgbr(b#)+rgbr(c#)+rgbr(d#)+rgbr(e#)+rgbr(f#)+rgbr(g#)+rgbr(h#)+rgbr(i#))/9.0
avg#=(rgbg(a#)+rgbg(b#)+rgbg(c#)+rgbg(d#)+rgbg(e#)+rgbg(f#)+rgbg(g#)+rgbg(h#)+rgbg(i#))/9.0
avb#=(rgbb(a#)+rgbb(b#)+rgbb(c#)+rgbb(d#)+rgbb(e#)+rgbb(f#)+rgbb(g#)+rgbb(h#)+rgbb(i#))/9.0
WriteToImageMemblock(2,512,512,x+(xt*32),y+(yt*32),avr#,avg#,avb#)
next y
next x
for x=0 to 31
px=x+(xt*32)
py=1+(yt*32)
a#=(ReadFromImageMemblock(2,512,512,px,py))
WriteToImageMemblock(2,512,512,x+(xt*32),(yt*32),rgbr(a#),rgbg(a#),rgbb(a#))
px=x+(xt*32)
py=30+(yt*32)
a#=(ReadFromImageMemblock(2,512,512,px,py))
WriteToImageMemblock(2,512,512,x+(xt*32),31+(yt*32),rgbr(a#),rgbg(a#),rgbb(a#))
next x
for y=1 to 30
px=1+(xt*32)
py=y+(yt*32)
a#=(ReadFromImageMemblock(2,512,512,px,py))
WriteToImageMemblock(2,512,512,(xt*32),y+(yt*32),rgbr(a#),rgbr(a#),rgbr(a#))
px=30+(xt*32)
py=y+(yt*32)
a#=(ReadFromImageMemblock(2,512,512,px,py))
WriteToImageMemblock(2,512,512,31+(xt*32),y+(yt*32),rgbr(a#),rgbr(a#),rgbr(a#))
next y
next yt
next xt
make image from memblock 2,2
save image "C:\documents and settings\graham\desktop\media\new scene_LightMap0.bmp",2
delete file "new scene_LightMap0_temp.bmp"
end
rem ============================================================================================
rem === WriteToImageMemblock() ===
rem ============================================================================================
function WriteToImageMemblock(MemblockID,ImageWidth,ImageHeight,X,Y,RedValue,GreenValue,BlueValue)
rem Find relative position in memblock
MemblockPosition=X+(Y*ImageWidth)
rem Check the position is in the memblock range
if MemblockPosition>=0
if MemblockPosition<(ImageWidth*ImageHeight)
rem Adjust the memblock accordingly
write memblock dword MemblockID,12+(MemblockPosition*4),rgb(RedValue,GreenValue,BlueValue)
endif
endif
rem End the function
endfunction
rem ============================================================================================
rem === ReadFromImageMemblock() ===
rem ============================================================================================
function ReadFromImageMemblock(MemblockID,ImageWidth,ImageHeight,X,Y)
rem Find relative position in memblock
MemblockPosition=X+(Y*ImageWidth)
rem Check the position is in the memblock range
if MemblockPosition>=0
if MemblockPosition<(ImageWidth*ImageHeight)
rem Adjust the memblock accordingly
ColorValue=memblock dword(MemblockID,12+(MemblockPosition*4))
endif
endif
rem End the function
endfunction ColorValue