# subdividing a mesh

This topic is 4967 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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!

##### Share on other sites
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?)

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
thanks.
no, CC can be applied to any Polygons. but the resulting mesh is always quads.

is it possible to tell the number before or not?

##### Share on other sites
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 * trisnumver of new tris = 0

yes, and more generally:
for each ngon
{
}

(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.

##### Share on other sites
Quote:
 Original post by sBibithe number of output vertices can be computed with:n_verts = vc + ec + fc

thank you! that seems to work!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 34
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634122
• Total Posts
3015643
×