Jump to content
  • Advertisement
Sign in to follow this  
ehmdjii

subdividing a mesh

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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?)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
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?

Share this post


Link to post
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 * 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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!