Lightmapping and Smoothing Groups?

Blitz3D Forums/Blitz3D Programming/Lightmapping and Smoothing Groups?

Gabriel(Posted 2007) [#1]
I'm trying to get my lightmapper producing decent results and the last major barrier I have is smoothing groups. Because the entire area of a triangle has the same surface normal, when you calculate the light value using that normal, you get sharp changes in the light/shade on the edge of every quad/triangle. So your smoothing groups are effectively wiped out.

So obviously the answer is to generate per-pixel surface normals instead of per-vertex, and I'm doing that with BaryCentric interpolation, and getting almost good results. There is a good smooth lighting value spread over the triangle, but there are little seams between the triangles which are actually slightly lighter than both sides. I can reduce the effect they have by blurring the final texture, and that's helpful, but ideally I'd like to get a really smooth lighting result over edges without resorting to brute force blurring.

Is there something else I need to do apart from interpolating the vertex normals across each triangle, is there a little adjustment needed to barycentric interpolation or have I just got a little bug somewhere?


big10p(Posted 2007) [#2]
Possibly a precision error? Are you using doubles in you calculations? (You're not using Blitz3D, right?)

I was just thinking that maybe some precision loss is causing calculations to put a point right on an edge, just outside the tri, screwing up the normal calculation?

Just a stab in the dark.