Sponsored By

Refining Smooth Lightmaps

A few weeks ago we added consideration of smooth groups in the lightmap calculations. 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...

Josh Klint, Blogger

June 19, 2013

2 Min Read
Game Developer logo in a gray background | Game Developer

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:
Attached Image

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:
Attached Image

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:
Attached Image

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. 

Read more about:

Blogs

About the Author

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like