Jump to content

  • Log In with Google      Sign In   
  • Create Account


Assimp number of vertices


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Tasaq   Members   -  Reputation: 1212

Like
0Likes
Like

Posted 24 October 2012 - 11:08 AM

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?

Sponsor:

#2 Kaptein   Prime Members   -  Reputation: 2039

Like
3Likes
Like

Posted 24 October 2012 - 01:33 PM

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 Posted Image

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)

Edited by Kaptein, 24 October 2012 - 01:38 PM.


#3 Tasaq   Members   -  Reputation: 1212

Like
0Likes
Like

Posted 24 October 2012 - 02:14 PM

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 :) )

#4 Brother Bob   Moderators   -  Reputation: 8010

Like
2Likes
Like

Posted 25 October 2012 - 02:15 AM

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.

Edited by Brother Bob, 25 October 2012 - 02:17 AM.


#5 Tasaq   Members   -  Reputation: 1212

Like
0Likes
Like

Posted 25 October 2012 - 12:50 PM

So that means if I try making model in a specific way I can reduce number of vertices right?

#6 Brother Bob   Moderators   -  Reputation: 8010

Like
1Likes
Like

Posted 25 October 2012 - 04:14 PM

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.

#7 Kaptein   Prime Members   -  Reputation: 2039

Like
0Likes
Like

Posted 25 October 2012 - 07:55 PM

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)

#8 Tasaq   Members   -  Reputation: 1212

Like
0Likes
Like

Posted 26 October 2012 - 01:04 PM

I didn't mean only about box but models in general ;) But I get the idea, thank you for help :D




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS