subdividing a mesh

Started by
6 comments, last by ehmdjii 18 years, 10 months ago
hello, i have a mesh datastructure that consists of quads and triangles. now i want to apply a subdivision algorithm that for the first step only creates the topological subdivision. (no vertex moving) which algorithm is best suited for a mesh of tris+quads? im currently thinking catmull-clark. am i correct here: number of new quads = 4 * quads + 3 * tris numver of new tris = 0 and what would be the number of vertices in the new mesh? (open meshes are possible too) thanks!
Advertisement
ok, to form the question easier:

in a mesh i know the number of vertices, edges, quads and triangles.

what is the number of vertices after catmull-clark subdivision?

(is it even predictable?)
I fail to see the point in your request.

Subdivision is a type of mesh smoothing, so, yes, it does create new vertices and triangles.
yes. but can you determine the number of vertices after one subdivision step? (before doing the subdivision itself)

i need it to allocate my new vertex array.
I'd recommend not using a compact model format for subdivision. Just have a vector of Vertex structs or something, and keep pushing them back :). Then maybe after the subdivision step transfer them to a buffer for rendering.

I thought CC was just for quads? If you have quads AND triangles, you probably want a triangle subdivision scheme, which means something like loop subdivision. You can predict the number of vertices on the other side, although it becomes horribly complex if your mesh has boundaries. Just predict, based on what you know of the topology, how many times each mask will be applied. It's probably more trouble than it's worth though.
thanks.
no, CC can be applied to any Polygons. but the resulting mesh is always quads.

thanks for your advise. still i'd like to have an answer to my question. ;)
is it possible to tell the number before or not?
w00f> catmull-clark subdivision scheme can be applied to ngons, not only quads and tris, you can very well use it to subdivide a mesh made out of 100-gons if you like, (instead of 3 or 4-gons (respectively tris and quads))

Quote:am i correct here:
number of new quads = 4 * quads + 3 * tris
numver of new tris = 0


yes, and more generally:
for each ngon
{
quad_count += ngon level
}

(where "ngon level" is the number of vertices in the ngon)

Quote:and what would be the number of vertices in the new mesh? (open meshes are possible too)


you will need more information than just the initial number of faces and vertices to do this, especially if your mesh isn't closed, or has duplicate vertices (if you want to handle whatever per-vertex data discontinuity, like hard edges on your surface (normal discontinuity), or texcoords discontinuities (almost unavoidable for most closed textured meshes))

the number of output vertices can be computed with:
n_verts = vc + ec + fc

where vc is your vertex count, ec your edge count, and fc your face count before subdivision.
you keep each vertex, you subdivide each edge (each edge will generate a vertex at its midpoint), and you add a vertex at the centroid of each face.
Quote:Original post by sBibi
the number of output vertices can be computed with:
n_verts = vc + ec + fc


thank you! that seems to work!

This topic is closed to new replies.

Advertisement