Hello.
I´m trying to develope a lightmapping system, mainly for learning purpose, a just-for-fun-project.
But now there is one problem i just cannot solve:
A mesh gets lightmapped, the maps are displayed, the textures seem to fit - but the lightmaps seem to bleed.
I´ve read all i could find (blitzbasic.com-forum, blitzcoder-forum, other graphics-boards,...) about this problem, but none of my wannabe-solutions fixed the problem.
Maybe somebody of the b3d-masters can help me out?
The code to create a lightmap image and setup of texture coords:
It´s just the code, working (with bleeding), erased my attempts - better to read...
Screenshot:

Any help would really be appreciated.
Cy
I´m trying to develope a lightmapping system, mainly for learning purpose, a just-for-fun-project.
But now there is one problem i just cannot solve:
A mesh gets lightmapped, the maps are displayed, the textures seem to fit - but the lightmaps seem to bleed.
I´ve read all i could find (blitzbasic.com-forum, blitzcoder-forum, other graphics-boards,...) about this problem, but none of my wannabe-solutions fixed the problem.
Maybe somebody of the b3d-masters can help me out?
The code to create a lightmap image and setup of texture coords:
Function create_lightmap(meshobj,size#,lmsize#,cset=0) fnt=LoadFont("arial",10) SetFont fnt For sys.lmsystem=Each lmsystem tricount=sys\tris Next mapw#=tricount*size maph#=size x#=0 y#=0 lm=CreateTexture(lmsize,lmsize,512) SetBuffer TextureBuffer(lm) For tri.triangle=Each triangle DebugLog "Tri: "+t+" X:"+x CopyRect(0,0,size,size,x,y,TextureBuffer(tri\lightmap),TextureBuffer(lm)) ;********************************** ;right here seems to be the problem For vert=0 To 2 u#=((tri\pu[vert] * (size /lmsize) )+(x/lmsize)) v#=((tri\pv[vert] * (size / lmsize) )+(y/lmsize)) DebugLog "VERTEX "+tri\vert[vert]+" Texturcoord: "+u*mapw+" "+v*maph+" - "+tri\pu[vert]+" "+tri\pv[vert] VertexTexCoords(tri\surface,tri\vert[vert],u,v,1,cset) ;********************************* Next ;Color 255,255,255 ;Rect x,y,size,size,0 DebugLog "" x=x+size t=t+1 Next SetBuffer BackBuffer() TextureCoords lm,cset TextureBlend(lm,3) EntityTexture(meshobj,lm,0,cset) mapimage=CreateImage(mapw+20,maph+20) CopyRect(0,0,mapw+20,maph+20,0,0,TextureBuffer(lm),ImageBuffer(mapimage)) Return(lm) End Function
It´s just the code, working (with bleeding), erased my attempts - better to read...
Screenshot:

Any help would really be appreciated.
Cy
