# Refining Smooth Lightmaps

You may recall a few weeks ago we added consideration of smooth groups in the lightmap calculations. ** (Explanation for new people: we use a forward renderer with static lighting as a fallback that runs across-the-board, and are working on a deferred OpenGL 4 renderer for the next major update. I've been working with deferred rendering since 2006, so this is relatively easy to add.)**

You may recall the case of luxels (lightmap pixels) that fall outside a face were problematic, and I used a bit of a hack to resolve them. It turns out my hack was fine in situations where the face was interpolated in a single direction, but failed when the face was curved on two axes. You can see the ugly artifacts that appear across the edges on this sphere:

I wanted to resolve this today, and it was quite difficult. I tried increasing the size of the polygon edges mathematically, I tried moving the test point inside the polygon. For some reason these both failed, and I couldn't tell exactly why.

The solution was very simple. I just found the closest edge the test point lies along, and then did a linear interpolation between the two corners making that edge. It works perfectly, and gives the exact same value moving the point inside the polygon would yield:

So you can look forward to improved static lighting on all surfaces in the next patch. The images below are texture-based lightmaps, not dynamic shading:

CSG modeling is very easy to use, but in the past has been limited to faceted and chunky shapes. Smooth groups let you model complex curved architecture with our CSG modeling tools.

## 3 Comments

## Recommended Comments

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.