Jump to content

Refining Smooth Lightmaps

Josh

1,744 views

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:

blogentry-1-0-44501400-1371686356_thumb.jpg

 

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:

blogentry-1-0-00913700-1371686362_thumb.jpg

 

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:

blogentry-1-0-78034100-1371686455_thumb.jpg

 

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

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...