Shared vertices models

NoodlesOnMyBack

19-02-2008 13:43:09

I know this is not related with PagedGeometry but in some way it does.

So, Shared Vertices... i really dont know what that is :lol: But i read somewhere around here that PG cant load them.
If i choose the ogrehead.mesh it works nice, and generates the impostor image, but when i try to load some mesh files of trees that i converted from 3ds files, they crash (but i can load them normaly on Ogre).

Q1: Where can i get mesh files or 3ds files of trees without 'shared vertices'?
Q2: Can anyone explain why this happens and how to avoid it when creating 3d models?
Q3: Is there some kind of converter?

JohnJ

19-02-2008 15:52:17

Shared vertices are when the model contains all the vertex data for every submesh in a single buffer, I believe. This can be give better performance for normal entity rendering I think, but for batched geometry it gives absolutely no advantage. In fact, it's somewhat difficult to take a mesh with shared vertices and batch it efficiently.

Q1: Where can i get mesh files or 3ds files of trees without 'shared vertices'?
I don't know, but I do know that the Blender exporter doesn't use shared vertices.

Q2: Can anyone explain why this happens and how to avoid it when creating 3d models?
Q3: Is there some kind of converter?

I'm not sure how to convert to non-shared. Maybe asking on the main Ogre forums would help.

Anyway, if Ogre wasn't LGPL I could have had shared vertices working long ago, since Ogre already has this problem solved. Unfortunately all I can do is use Ogre code as a rough guide to keep PagedGeometry under the zlib license. I planned on fixing the shared vertex issue a long time ago, but put it off in favor of other bug-fixes, etc. I'll try to spend some time on this issue within the next 1-2 weeks, since this is definitely a needed feature.

luis

19-07-2008 20:10:33

Hi JohnJ, thanks for sharing this great library!

Anyway, if Ogre wasn't LGPL I could have had shared vertices working long ago, since Ogre already has this problem solved. Unfortunately all I can do is use Ogre code as a rough guide to keep PagedGeometry under the zlib license. I planned on fixing the shared vertex issue a long time ago, but put it off in favor of other bug-fixes, etc. I'll try to spend some time on this issue within the next 1-2 weeks, since this is definitely a needed feature.

Any progress with that ? I really need that feature, all the trees i have are done with shared vertices... I think if you just "borrow" a few lines of code it wont be a problem.
I dont know much about this 'bug' but may be if you use some of the code in the wiki (I believe that code is in public domain) like this??
http://www.ogre3d.org/wiki/index.php/RetrieveVertexData
does it helps ? (I'm a complete ignorant about the way PagedGeometry works internally)

JohnJ

23-07-2008 16:08:37

The problem with shared vertices is that internally, they are just plain incompatible with batching. You simply cannot efficiently batch a multi-material mesh using shared vertexes. The only solution is to convert the mesh into non-shared vertices, and that's the problem. I could write code that does this, but the question is, what level of the code should convert the mesh? If it's done automatically by the batching system, it will be less efficient and batch slightly slower, even for people not using shared vertices. If I give you a function that converts a shared vertex mesh to a non-shared one, it won't be transparent or very easy to use.

But the main reason I still haven't implemented this is writing code to un-share the vertexes will probably take about a full day, and unfortunately I often don't have that much time for my own projects, much less a PagedGeometry feature I'll never use. But if I can I'll try to spend the next day I have off to adding this feature.

(Oh, and thanks for that code - it looks like it might be really helpful for this)

Jules Robichaud Gagnon

23-07-2008 20:14:45

http://www.ogre3d.org/phpBB2/viewtopic. ... s&start=25

Have you checked OgreMeshMagick? I read it can reorganize shared vertices and vertices. I never used it myself though.

xadh00m

24-07-2008 09:02:34

Hi John!

Do you know where I can find information about setting up a static mesh right?
We have a large static scene and have troubles with lights (ínternal distance calculations etc.)
and some performance issues which we hopefully can fix with a right static geometry management...

Thx

luis

24-07-2008 09:18:41

But the main reason I still haven't implemented this is writing code to un-share the vertexes will probably take about a full day, and unfortunately I often don't have that much time for my own projects, much less a PagedGeometry feature I'll never use. But if I can I'll try to spend the next day I have off to adding this feature.
I understand you very well, it is the same for me ;)
If I give you a function that converts a shared vertex mesh to a non-shared one, it won't be transparent or very easy to use.
StaticGeometry in Ogre does it automatically in the Entity, perhaps you could do it like this or make a new function for converting Entities. I dont think it will be hard or not easy to use....
Have you checked OgreMeshMagick? I read it can reorganize shared vertices and vertices. I never used it myself though.
i read the post and seems it doesn't support any shared-nonshared verticies conversion :(
Maybe asking for that feature in that thread.....

alext

24-07-2008 15:05:57

Noodlesonmyback,

I'm not sure if any of these replies have helped you with your problem, and you sound like you're coming at it from more of an artist's POV. The easiest way to remove shared vertices between materials may be to make separate layers. I haven't used 3DS Max myself, but if there is a "separate layer but same mesh" way to segregate by materials, that may solve it when it comes time to export to .mesh format.

Another solution that may work is selecting all the polys of a material, and simply hitting cut and paste. At the very least, the polygons of that material will no longer be indexing to exactly the same vertices (although the model still may get exported with a "shared vertex" buffer). Basically, if multiple materials share a coincident vertex, they need to each have their own copy of that vertex.

Jules Robichaud Gagnon

31-07-2008 12:16:33

I figured out how to support shared vertices. I cannot implement it now but because I am in a big rush and I have nothing to test but maybe next week.
Can anyone provide me a model with shared vertices so I can test when I have time please?

luis

31-07-2008 14:38:11

I figured out how to support shared vertices. I cannot implement it now but because I am in a big rush and I have nothing to test but maybe next week.
Can anyone provide me a model with shared vertices so I can test when I have time please?

sure, follow my sign to g-boot.com and download thunderwheels (~60Mb), once installed go to:
Thunder Wheels Demo 0.4\media\terrain\objects
all files tree*.mesh have shared vertices.

or if you can't/wan't download the game just send me a PM with your email address, I can send it to you.

Thanks!!
Luis.

Jules Robichaud Gagnon

01-08-2008 00:26:08

Can you email me a zip with the mesh, texture and material only ( email button ) please. That would save me some trouble to extract it all.

luis

01-08-2008 11:15:22

I cant see your email button... do you have it enabled in you profile ? (Always show my e-mail address).

Jules Robichaud Gagnon

01-08-2008 11:31:47

I forgot I could see the button because I am a moderator. :roll:

You should be able to see it now.

luke

07-08-2008 20:54:42

Hi guys, I created my own shared vertices converter and works well for me.

I attached zip with source, so please add it into PagedGeometry svn (i don't know if svn is public and i don't know where i add into) or something you desire.

It takes 3 hours of my life! :D

http://www.stud.fit.vutbr.cz/~xhorak48/converter.zip

JohnJ

08-08-2008 02:23:39

Thanks! That looks very good - I'll try to integrate this into PagedGeometry this weekend if possible. I've almost finished writing a converter myself, but this is very helpful either way :D.

JohnJ

10-08-2008 23:52:43

Ok, thanks to "luke", PagedGeometry now supports meshes with shared vertices! His code worked perfectly, and is used to automatically convert shared vertex meshes to non-shared when necessary. It's still recommended to avoid shared vertexes though, because it can slow loading down slightly.

If everyone can confirm that shared vertexes work using the PagedGeometry from SVN, then I can release the latest version in the ZIP format (it's about time for a new maintenance release for .zip users - a lot of bugs have been fixed since 1.05).

luke

11-08-2008 20:13:22

:D Small beauty change: In function "CountUsedVertices" is redundant death variable, "std::map<uint16, uint32> histogram;" on two places. I thing the compiler ignore it in generating code but who knows...