Next: , Previous: BBOX, Up: Object File Formats

4.2.4 Bezier Surfaces

The conventional file suffixes for Bezier surface files are .bbp or .bez. A file with either suffix may contain either type of patch.


       [ST]BBP -or- [C]BEZ<Nu><Nv><Nd>[_ST]
     			# Nu, Nv are u- and v-direction
     			# polynomial degrees in range 1..6
     			# Nd = dimension: 3->3-D, 4->4-D (rational)
     			# (The '<' and '>' do not appear in the input.)
     			# Nu,Nv,Nd are each a single decimal digit.
     			# BBP form implies Nu=Nv=Nd=3 so BBP = BEZ333.
     		# Any number of patches follow the header
     			# (Nu+1)*(Nv+1) patch control points
     			# each 3 or 4 floats according to header
       vertex(u=0,v=0)  vertex(1,0) ... vertex(Nu,0)
       vertex(0,1)			   ... vertex(Nu,1)
       vertex(0,Nv)		   ... vertex(Nu,Nv)
     			# ST texture coordinates if mentioned in header
       S(u=0,v=0)	T(0,0)	S(0,Nv) T(0,Nv)
       S(Nu,0)	T(Nu,0)	S(Nu,Nv) T(Nu,Nv)
     			# 4-component float (0..1) R G B A colors
     			# for each patch corner if mentioned in header
       RGBA(0,0)   RGBA(0,Nv)
       RGBA(Nu,0)  RGBA(Nu,Nv)

These formats represent collections of Bezier surface patches, of degrees up to 6, and with 3-D or 4-D (rational) vertices.

The header keyword has the forms [ST]BBP or [C]BEZ<Nu><Nv><Nd>[_ST] (the '<' and '>' are not part of the keyword.

The ST prefix on BBP, or _ST suffix on BEZuvn, indicates that each patch includes four pairs of floating-point texture-space coordinates, one for each corner of the patch.

The C prefix on BEZuvn indicates a colored patch, including four sets of four-component floating-point colors (red, green, blue, and alpha) in the range 0..1, one color for each corner.

Nu and Nv, each a single digit in the range 1..6, are the patch's polynomial degree in the u and v direction respectively.

Nd is the number of components in each patch vertex, and must be either 3 for 3-D or 4 for homogeneous coordinates, that is, rational patches.

BBP patches are bicubic patches with 3-D vertices, so BBP = BEZ333 and STBBP = BEZ333_ST.

Any number of patches follow the header. Each patch comprises a series of patch vertices, followed by optional (s,t) texture coordinates, followed by optional (r,g,b,a) colors.

Each patch has (Nu+1)*(Nv+1) vertices in v-major order, so that if we designate a vertex by its control point indices (u,v) the order is

          (0,0) (1,0) (2,0) ...  (Nu,0)
          (0,1) (1,1) (2,1) ...  (Nu,1)
          (0,Nv)            ...  (Nu,Nv)

with each vertex containing either 3 or 4 floating-point numbers as specified by the header.

If the header calls for ST coordinates, four pairs of floating-point numbers follow: the texture-space coordinates for the (0,0), (Nu,0), (0,Nv), and (Nu,Nv) corners of the patch, respectively.

If the header calls for colors, four four-component (red, green, blue, alpha) floating-point colors follow, one for each patch corner.

The series of patches ends at end-of-file, or with a closebrace if incorporated in an object reference.