Assimp number of vertices

Started by
6 comments, last by Tasaq 11 years, 5 months ago
Hi everyone,

I am writing my own model class to use with openGL. When playing with assimp i noticed that there are always to many vertices. I created simple box in max (12 polys, 8 verts). When I load it with assimp it says it got 24 verts. When loading the model I added aiProcess_JoinIdenticalVertices. Without it mNumVertices says there are 36 verts (which seems more legit for me). I also tried different file formats but no luck. why it won't show 8? Am I missing/don't know something?
Advertisement
no, you are unfortunately not missing anything..
you have 6 faces, with 4 vertices each, and those 6 faces each have a different normal, that means you can't have shared vertices...
it's the unfortunate reality of todays rasterizers
you can however use points to define them, if all the vertices that share the same face (and normal) have the exact same attributes
this is how we can sometimes use geometry shaders to emit these faces with just 1 point (or at least, i think so)

anyways, there comes a day when you want to have different values for each vertex even sharing the same face
and so your boxes will never (ever) have shared vertices.. unless you cheat and average the normals
i can't tell you how that will look, other than that i probably couldn't live with it personally smile.png

i'm sure other people can give you some other alternatives, but these are the only 3 alternatives i know of
averaging normals is ok on larger meshes or models to get smooth lighting
your box just doesn't have enough surface points to use smooth normals on, and so it doesn't support shared vertices (indices)
When You mentioned normals it made sense for me. Still it hurts to think that 100k verts model will have around 300k after loading...
I tought that normals are always averaged... And I presume that I would have to write it on my own, which would lenghten loading process :\
Still, I am happy to see that I can render my model for now :) If no one will give relatively simple idea I will deal with it.

(It's time to learn modeling better low poly models :) )
A model with 100k vertices MAY have, not will have, 300k after loading. For obvious reasons, you cannot share two vertices that have different values with the same index, and a cube simply has no shared vertices. Your average model with smooth surfaces is going to have plenty of shared vertices. The problem is sharp corners; at those points you have discontinuities in some attribute, typically the normal, and those are the cases where you cannot have shared vertices anymore. A cube consists entirely of sharp corners.
So that means if I try making model in a specific way I can reduce number of vertices right?
It's not about modelling it a specific way. It about having sharp or smooth edges. You don't model your cube with smooth edges, not do you model your sphere with sharp edges. If you need sharp edges then you need sharp edges, it's as simple as that.
if you want a cube with smooth edges, look at chamferbox primitive (it's really just a rounded box, except chamfer* is more awesome title)
I didn't mean only about box but models in general ;) But I get the idea, thank you for help :D

This topic is closed to new replies.

Advertisement