Progressive Mesh Buffer / Mesh simplification

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Re: Progressive Mesh Buffer / Mesh simplification

Postby mongoose7 » Fri Apr 06, 2012 7:16 am

Well, I understood your previous remark anyway. I just don't believe that Irrlicht creates extra vertices. But you have explained why is doesn't remove duplicate vertices, which appears to be what is happening in this case.

So, I am at a loss as to why holes are being created. There is an error at Line 499 in ProgressiveMeshBuffer.cpp, so it could never detect duplicate edges. But fixing this doesn't fix the problem - holes start to appear around the wheel hubs of the car after removing 33% (or so) of the vertices.
mongoose7
 
Posts: 515
Joined: Wed Apr 06, 2011 12:13 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby Lonesome Ducky » Fri Apr 06, 2012 9:29 am

Well if you don't believe it, check the obj file. There are only 5 vertices listed, but irrlicht says there are 12 in the mesh.
User avatar
Lonesome Ducky
Competition winner
 
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby RdR » Fri Apr 06, 2012 10:32 am

Lonesome Ducky, thanks for the case, haven't thought about this because it never occurred for me.

Problem can be improved (not completely fixed) by creating your own createMeshWelded() function to ignore the UV coordinates, normals etc.
But can give some weird texture results.

mongoose7 wrote: There is an error at Line 499 in ProgressiveMeshBuffer.cpp, so it could never detect duplicate edges.
But fixing this doesn't fix the problem - holes start to appear around the wheel hubs of the car after removing 33% (or so) of the vertices.


What error and how did you fixed it?
User avatar
RdR
Competition winner
 
Posts: 259
Joined: Tue Mar 29, 2011 2:58 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby mongoose7 » Fri Apr 06, 2012 11:22 am

You pass 0 as the second parameter instead of 'e'. It is pretty obvious - you are trying to add an edge to a map but the insert doesn't contain the edge. But I didn't find it - VS2010 refused to compile it.
mongoose7
 
Posts: 515
Joined: Wed Apr 06, 2011 12:13 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby mongoose7 » Fri Apr 06, 2012 11:49 am

Lonesome Ducky wrote:Well if you don't believe it, check the obj file. There are only 5 vertices listed, but irrlicht says there are 12 in the mesh.

I had a look at the code and the OBJ file loader reinterprets the file. I don't think this could be the case for the formats that support animation, though. But you were right, if you use the OBJ format, the loader can create extra vertices.
mongoose7
 
Posts: 515
Joined: Wed Apr 06, 2011 12:13 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby RdR » Fri Apr 06, 2012 1:31 pm

mongoose7 wrote:You pass 0 as the second parameter instead of 'e'. It is pretty obvious - you are trying to add an edge to a map but the insert doesn't contain the edge. But I didn't find it - VS2010 refused to compile it.


Hmmm I don' t have any compilation errors with GCC (Linux or MinGW) and doesn't matter for the effect of the edges, not checking by object but by the unique ID string of an edge.

But will change it when I get home, thanks for reporting.
User avatar
RdR
Competition winner
 
Posts: 259
Joined: Tue Mar 29, 2011 2:58 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby hybrid » Fri Apr 06, 2012 5:08 pm

Also animated meshes create extra vertices. Animation is simply duplicated for those vertices.
hybrid
Admin
 
Posts: 13946
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: Progressive Mesh Buffer / Mesh simplification

Postby mongoose7 » Sat Apr 07, 2012 3:55 am

RdR wrote:Hmmm I don' t have any compilation errors with GCC (Linux or MinGW) and doesn't matter for the effect of the edges, not checking by object but by the unique ID string of an edge.

OK. I guess I didn't look closely. It was a bit scary when VS 2010 said there were 6 signatures and none matched. To prove it, it showed me Ty1, Ty2, Ty, ky, ... :shock: But it really seemed to be complaining that an integer ('0') does not match the type 'Edge *'. I was distracted because I was looking for more edges but, as Lonesome Ducky pointed out, those edges did not end on the vertex in question.

Here is the error. (The line number is different because I added some debugging to the code.)
cpp Code: Select all
1>ClCompile:
1>  ProgressiveMeshBuffer.cpp
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(163): error C2440: 'initializing' : cannot convert from 'int' to 'Edge *'
1>          Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(247) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<irr::core::stringw&,_Ty>(_Other1,_Other2 &&)' being compiled
1>          with
1>          [
1>              _Ty1=irr::core::stringw,
1>              _Ty2=Edge *,
1>              _Ty=int,
1>              _Other1=irr::core::stringw &,
1>              _Other2=int
1>          ]
1>          ProgressiveMeshBuffer.cpp(537) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<irr::core::stringw&,int>(_Other1,_Other2 &&)' being compiled
1>          with
1>          [
1>              _Ty1=irr::core::stringw,
1>              _Ty2=Edge *,
1>              _Other1=irr::core::stringw &,
1>              _Other2=int
1>          ]
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::second' : member could not be initialized
1>          with
1>          [
1>              _Ty1=irr::core::stringw,
1>              _Ty2=Edge *
1>          ]
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(167) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::second'
1>          with
1>          [
1>              _Ty1=irr::core::stringw,
1>              _Ty2=Edge *
1>          ]
1>
1>Build FAILED.


hybrid wrote:Also animated meshes create extra vertices. Animation is simply duplicated for those vertices.

OK, thanks.
mongoose7
 
Posts: 515
Joined: Wed Apr 06, 2011 12:13 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby REDDemon » Wed Apr 25, 2012 1:08 am

I figured now several ways to improve performance of your code alot. If I have time I implement test and post. (i think a x4 or more speed up factor is really possible). possible use for real-time also.
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Progressive Mesh Buffer / Mesh simplification

Postby ACE247 » Wed Apr 25, 2012 8:37 am

Would be brilliant If you could share that one, REDDemon! :D
I'm kinda using this excessively to bake LOD meshes for simple environment geometry and batching a folder can take ages!
H8L6L5M4G3H5M7N8S7N9O1R8J1P5M7N9O4P2Q5R6T7U4M3N8X6S5T8W (If you want the secret, why not 'TRY' decrypting it? )
This Door's lock doesn't need a key, the Lock is the key to open the Lock and you don't know how to turn the key...
Link: My Blog :)
User avatar
ACE247
 
Posts: 695
Joined: Tue Mar 16, 2010 12:31 am
Location: Namibia

Re: Progressive Mesh Buffer / Mesh simplification

Postby RdR » Wed Apr 25, 2012 8:55 am

REDDemon wrote:I figured now several ways to improve performance of your code alot. If I have time I implement test and post. (i think a x4 or more speed up factor is really possible). possible use for real-time also.


Oh nice, would like to see that aswell!
What do you intend to improve?
User avatar
RdR
Competition winner
 
Posts: 259
Joined: Tue Mar 29, 2011 2:58 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby REDDemon » Wed Apr 25, 2012 7:01 pm

depend on the time I can spend on it. 1 new algorithm probably . std::vector is pretty slow. probably use a C style array wrapped as vector. no more.
using Std::vector<Vertex*> is 2 indirections for each vertex. Potentially slow and prone to cache misses. I will share it of course... when it's done
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Progressive Mesh Buffer / Mesh simplification

Postby RdR » Thu Apr 26, 2012 8:20 pm

REDDemon wrote:depend on the time I can spend on it. 1 new algorithm probably . std::vector is pretty slow. probably use a C style array wrapped as vector. no more.
using Std::vector<Vertex*> is 2 indirections for each vertex. Potentially slow and prone to cache misses. I will share it of course... when it's done


Ok nice, would like to see the numbers (especially for the high LOD bunny) when you have time to apply those fixes / changes :D
User avatar
RdR
Competition winner
 
Posts: 259
Joined: Tue Mar 29, 2011 2:58 pm

Re: Progressive Mesh Buffer / Mesh simplification

Postby wing64 » Mon Apr 30, 2012 2:00 pm

Opz code
Image

Original code
Image

Code Opz from idea REDDemon
http://www.4shared.com/rar/YwQkZvpi/Pro ... r_opz.html
wing64
Competition winner
 
Posts: 201
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand

Re: Progressive Mesh Buffer / Mesh simplification

Postby REDDemon » Mon Apr 30, 2012 2:32 pm

oh thnanks. you preceeded me :) I already had to start writing.. Glad you used my idea :). As previously supposed the speed up was of 4x (seems also to be up to 5x in certain case). I didn't thinked to be so precise.

Good work wing64!
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

PreviousNext

Return to Project Announcements

Who is online

Users browsing this forum: Seven and 1 guest