Monday, June 3, 2013

Smoother rendering

I did a first pass at implementing sub division surfaces. At the moment it's pretty much a straight implementation of the Loop subdivision surface algorithm described in pbrt. It iteratively subdivides a triangle mesh a user defined number of times to estimate the limit surface of the original base mesh. Conceptually it's rather straight forward: Each triangle becomes 4 new ones with vertices at the midpoint of each edge, but the implementation turned out to be more hairy than I had assumed, with edge cases for boundary edges and assumptions about the vertex order in the base mesh.

I still have some work left before moving on, as right now all I do is sub divide the vertices and assign them the limit surface normal. I need to also interpolate prim vars (UVs, etc), and I want to look into camera space driven subdivision level akin to the Shading Rate in prman, although that rabbit hole might go deeper than the benefits of a global dicing knob justifies.

Here's a quick test of sub dividing some pots and pans from the kitchen scene in the last post:


Level 0 - 7 968 triangles

Level 1 - 31 866 triangles
Level 2 - 127 458 triangles
Level 3 - 509 826 triangles
 
-Espen

No comments:

Post a Comment