I have solved the dark edges in lightmaps problem!

Blitz3D Forums/Blitz3D Programming/I have solved the dark edges in lightmaps problem!

Okay, I fixed the problems.

First, I set the lightmapping function so it would accept the current lumel size as a parameter. Then, I used that value to calculate the corners of the lumel. Then I check all four corners of each lumel to see if it can see the light source. If ALL of them can, then that lumel is in the light.

(You might want to increase the size you pass to the function depending on the amount of blur you use. It may help to avoid areas being lit by the blur that should not be lit.)

Then, I added a constant which allows you to move the lumel pivot away from the surface it is illuminating in the direction of the lightmap mapping. By moving it away from the surface a tiny bit, objects that rest flat on the ground and have bottoms no longer have black outlines around them on the ground, and there are no black outlines around the edges of some objects like the cube which had some new black outlines caused by the more agressive shadowing.

The only remaining issue is that the dark top of the cube has a tiny bit of light at the fornt and back edges. I'm not sure why this is. I think it might have to do with the light under the wall leak issue with this different way of lighting. In that case I don't know how to solve it.

Here's a pic of the latest version:



And here's a link to the latest code. The terrain functions still need to be updated. I'm not gonna muck about with it though, I'm just messing around with this cause I'm bored.

http://home.earthlink.net/~sswift/514-004.bb

I think I'm gonna try one last thing with this. I'm gonna try going back to the old method of calculating which lumels are hit by light, but then make any lumel which has a corner that is lit be lit, and see what that does.