I implemented the lightmap calculation algorithm. It kinda works.
1. I create a individual mesh.
2. for each face of the original mesh,
2a. I create a meshbuffer and add to the new mesh
using 'S3DVertex2TCoords' for each vertice.
2b. I calculate the light map UV coordinates and all the
lumels positions.
2c. I calculate the light rgb value for each lumel using
the simple N.L lighting model for each static light
and assign each lumel with that value.
2d. Blur the current face's calculated lightmap.
The problem is for invalid lumels handling. I will illustrate using some pictures.
The result is like following if I set all the invalid lumels to red color in step 2c.
Then I tried to set the invalid lumels to the closest valid lumel color, the result is
It doesn't solve the bleeding problem.
What if I also sample the invalid lumels? The result is
It reduced the diagonal edges' bleeding greatly, but still the horizontal and vertical bleeding problems never get away.
Can anyone suggest me a way to solve this problem? Thanks..
the above results[/img]