OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Converting PrimitiveSet to use triangles instead of triangle strips / fans?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Waaayoff
Newbie


Joined: 16 Jul 2018
Posts: 8

PostPosted: Fri Jul 27, 2018 12:06 pm    Post subject:
Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:


Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);


for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks
Back to top
View user's profile Send private message
Waaayoff
Newbie


Joined: 16 Jul 2018
Posts: 8

PostPosted: Wed Aug 15, 2018 7:10 am    Post subject:
Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:



Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);



for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74401#74401







------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
L. Voerman
Guest





PostPosted: Wed Aug 15, 2018 8:42 am    Post subject:
Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

I tend to use set OSG_OPTIMIZER=INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM

for these, but there might be something else preventing the optimizer from changing your geometry.
set OSG_OPTIMIZER=STATIC_OBJECT_DETECTION  INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM MERGE_GEOMETRY MERGE_GEODES

might do the trick
Laurens.


On Wed, Aug 15, 2018 at 9:10 AM Jad Killian < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:



Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);



for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74401#74401





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 519
Location: France

PostPosted: Wed Aug 15, 2018 10:13 pm    Post subject:
Re: Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

INDEX_mesh don't reindex indexed
I fix it on my branch introducing a forceReindex parameter to the IndexMeshVisitor and use it witout an attached Optimizer

L. Voerman wrote:
I tend to use set OSG_OPTIMIZER=INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM

for these, but there might be something else preventing the optimizer from changing your geometry.
set OSG_OPTIMIZER=STATIC_OBJECT_DETECTION  INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM MERGE_GEOMETRY MERGE_GEODES

might do the trick
Laurens.


On Wed, Aug 15, 2018 at 9:10 AM Jad Killian < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:



Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);



for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74401#74401





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 519
Location: France

PostPosted: Wed Aug 15, 2018 10:23 pm    Post subject:
Re: Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

https://github.com/openscenegraph/OpenSceneGraph/pull/596
mp3butcher wrote:
INDEX_mesh don't reindex indexed
I fix it on my branch introducing a forceReindex parameter to the IndexMeshVisitor and use it witout an attached Optimizer

L. Voerman wrote:
I tend to use set OSG_OPTIMIZER=INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM

for these, but there might be something else preventing the optimizer from changing your geometry.
set OSG_OPTIMIZER=STATIC_OBJECT_DETECTION  INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM MERGE_GEOMETRY MERGE_GEODES

might do the trick
Laurens.


On Wed, Aug 15, 2018 at 9:10 AM Jad Killian < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:



Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);



for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74401#74401





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
Jordi Torres
Guest





PostPosted: Thu Aug 16, 2018 6:02 am    Post subject:
Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

Hi, 

There is an option in the obj plugin to avoid tristrips. It's probably better to try this cause tristripping is not cheap depending on the geometry. 


From the top of my head is something like "noTrisStripPolygons". 


Hope it helps.


El jue., 16 ago. 2018 12:30 a. m., Julien Valentin < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> escribió:

Quote:
INDEX_mesh don't reindex indexed
I fix it on my branch introducing a forceReindex parameter to the IndexMeshVisitor and use it witout an attached Optimizer


L. Voerman wrote:
Quote:
I tend to use set OSG_OPTIMIZER=INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM

for these, but there might be something else preventing the optimizer from changing your geometry.
set OSG_OPTIMIZER=STATIC_OBJECT_DETECTION  INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM MERGE_GEOMETRY MERGE_GEODES

might do the trick
Laurens.


On Wed, Aug 15, 2018 at 9:10 AM Jad Killian < ()> wrote:


Quote:
Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:



Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);



for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74401#74401 (http://forum.openscenegraph.org/viewtopic.php?p=74401#74401)





_______________________________________________
osg-users mailing list
  ()
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)



  ------------------
Post generated by Mail2Forum


------------------------
Twirling twirling twirling toward freedom

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74538#74538





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 519
Location: France

PostPosted: Thu Aug 16, 2018 7:40 pm    Post subject:
Re: Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

Hi Jordi
I admit I haven't read the question but the topic title remind me of a pr i haven't made...
Should'nt it be default obj plugin behavior not to strip instead of an option one have to set?
Is this pr valid to you?
https://github.com/openscenegraph/OpenSceneGraph/pull/597
Cheers

Jordi Torres wrote:
Hi, 

There is an option in the obj plugin to avoid tristrips. It's probably better to try this cause tristripping is not cheap depending on the geometry. 


From the top of my head is something like "noTrisStripPolygons". 


Hope it helps.


El jue., 16 ago. 2018 12:30 a. m., Julien Valentin < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> escribió:

Quote:
INDEX_mesh don't reindex indexed
I fix it on my branch introducing a forceReindex parameter to the IndexMeshVisitor and use it witout an attached Optimizer


L. Voerman wrote:
Quote:
I tend to use set OSG_OPTIMIZER=INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM

for these, but there might be something else preventing the optimizer from changing your geometry.
set OSG_OPTIMIZER=STATIC_OBJECT_DETECTION  INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM MERGE_GEOMETRY MERGE_GEODES

might do the trick
Laurens.


On Wed, Aug 15, 2018 at 9:10 AM Jad Killian < ()> wrote:


Quote:
Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:



Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);



for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74401#74401 (http://forum.openscenegraph.org/viewtopic.php?p=74401#74401)





_______________________________________________
osg-users mailing list
  ()
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)



  ------------------
Post generated by Mail2Forum


------------------------
Twirling twirling twirling toward freedom

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74538#74538





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 519
Location: France

PostPosted: Thu Aug 16, 2018 7:50 pm    Post subject:
Re: Converting PrimitiveSet to use triangles instead of triangle strips / fans?
Reply with quote

Oups made mistake in given pr good one is
I should have also remove the comment talking about perf enancement (so 90's)
Tristrip is good for HW but Optimizer generate multiple patch so duplicate one prim set into several (Draw Overhead)
Indexed Triangles nowadays have realy good perf

https://github.com/openscenegraph/OpenSceneGraph/pull/598

mp3butcher wrote:
Hi Jordi
I admit I haven't read the question but the topic title remind me of a pr i haven't made...
Should'nt it be default obj plugin behavior not to strip instead of an option one have to set?
Is this pr valid to you?
https://github.com/openscenegraph/OpenSceneGraph/pull/597
Cheers

Jordi Torres wrote:
Hi, 

There is an option in the obj plugin to avoid tristrips. It's probably better to try this cause tristripping is not cheap depending on the geometry. 


From the top of my head is something like "noTrisStripPolygons". 


Hope it helps.


El jue., 16 ago. 2018 12:30 a. m., Julien Valentin < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> escribió:

Quote:
INDEX_mesh don't reindex indexed
I fix it on my branch introducing a forceReindex parameter to the IndexMeshVisitor and use it witout an attached Optimizer


L. Voerman wrote:
Quote:
I tend to use set OSG_OPTIMIZER=INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM

for these, but there might be something else preventing the optimizer from changing your geometry.
set OSG_OPTIMIZER=STATIC_OBJECT_DETECTION  INDEX_MESH VERTEX_POSTTRANSFORM VERTEX_PRETRANSFORM MERGE_GEOMETRY MERGE_GEODES

might do the trick
Laurens.


On Wed, Aug 15, 2018 at 9:10 AM Jad Killian < ()> wrote:


Quote:
Hi,

When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:



Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);



for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?

Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74401#74401 (http://forum.openscenegraph.org/viewtopic.php?p=74401#74401)





_______________________________________________
osg-users mailing list
  ()
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)



  ------------------
Post generated by Mail2Forum


------------------------
Twirling twirling twirling toward freedom

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74538#74538





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Retrieve the triangles indices array ... Paradox General 1 Mon May 13, 2019 11:16 am View latest post
No new posts Converting an osg::Matrix to osg::Pos... Waaayoff General 0 Fri Jan 18, 2019 3:34 pm View latest post
No new posts [Help] OSG + ArKit: Problem convertin... Brayner General 4 Mon Oct 08, 2018 7:07 pm View latest post
No new posts Visualizing triangle data sam General 4 Wed Jun 13, 2018 9:52 pm View latest post
No new posts No specular maps, exporting from blen... Klemen Červ Plugins [osgPlugins] 1 Wed May 16, 2018 1:08 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP