[Bf-committers] Support for creases in subdivision surfaces

Matthew H. Plough bf-committers@blender.org
Fri, 07 May 2004 12:28:50 -0400


Chris McFarlen wrote:

>I added support for creases in the Catmull-Clark subdivision surfaces.  You can read about it and download the patch here:
>
Well Chris, congratulations!  You have officially scooped the work that 
I was planning to do!  This is an excellent addition to Blender, and 
should greatly increase the capabilities of subdivision surfaces. 

Chris McFarlen's website wrote:

> I extended the blender implementation to include creases, but my 
> implementation only defines a binary sharpness; no weight factors. An 
> edge is either sharp, or it isn't. This isn't as much of a limitation 
> as it might seem. No, really :)

This really is a limitation, and one that shouldn't be there.  The 
implementation that I had been working on includes weight factors; they 
are relatively easy to implement.  You are using a flag to set the 
subdivision level; seeing as Blender only subdivides out to level 6, 
using three bits (for a total of seven possible levels, as well as an 
off level) would allow you to implement weight factors.  Let's say that 
those are bits 31, 30, and 29 of a standard int.

(1) bit 31 -> 111* **** **** **** **** **** **** **** <-bit 0 would 
indicate an infinite crease edge,
(2) bit 31 -> 000* **** **** **** **** **** **** **** <-bit 0 would 
indicate a normal edge, and
(3) bit 31 -> 010* **** **** **** **** **** **** **** <-bit 0 would 
indicate an edge with sharp subdivision level 2. 

Since endian-ness is not an issue at runtime, it is a simple matter to 
shift the bits right, to

bit 31 -> 0000 0000 0000 0000 0000 0000 0000 0111 <-bit 0 (the result 
for an infinite crease edge)

Now, if the result is 0, then a smooth subdivision should be used.  
Otherwise, use a sharp subdivision, and decrement.  Then, shift the 
result back to

bit 31 -> 0010 0000 0000 0000 0000 0000 0000 0111 <-bit 0 (the result 
for a decremented (3), above)

and bitwise OR it into the flag integer for the resulting edge. 

I hope this is clear -- if not, say so, and I will try to explain it better.

Matt