have an OBJ with a Hole?

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

have an OBJ with a Hole? // SDK, Plug-in & 3rd Party Area

1  2  3  |  

Post by frootee // Feb 26, 2009, 3:16am

frootee
Total Posts: 2667
pic
Hi everyone. I am doing some testing on an OBJ importer and am concerned

about OBJ format objects 'with holes'. I've heard that OBJ format does not permit holes, but I am not sure if that is Always the case.


If you have an OBJ file that definitely has at least one hole in an object, please contact me via PM or email:


frootee@netzero.net


Thanks!


Froo

Post by prodigy // Feb 26, 2009, 5:22am

prodigy
Total Posts: 3029
pic
Why you need a OBJ with a hole???

PERVERT! :mad:

heheheh kidding, :D

No i don't have any OBJ with holes.. But hey, what if you made an object in Model side and then export it with LUUV? then open it again to find if the hole still present..

Post by Jack Edwards // Feb 26, 2009, 5:24am

Jack Edwards
Total Posts: 4062
pic
I'm pretty sure OBJ format doesn't support holes.

So Prodigy will be happy to know that it's a non-perforated format. :p

Post by frootee // Feb 26, 2009, 5:44am

frootee
Total Posts: 2667
pic
hehehe ok thanks Jack. Thanks for the laugh Prodigy haha!


I think I only need to be concerned with holes in geometry when I export to the OBJ format. Because in trueSpace we can create holes in the geometry, which are 'floating', i.e. not connected to the outer vertices of the mesh. So I need to ensure they are added correctly to the vertex / edge lists prior to triangulation. Triangulating fixes the hole in the mesh.

Post by trueBlue // Feb 26, 2009, 6:32am

trueBlue
Total Posts: 1761
pic
The LUUV plug-in has a Help file that may be helpful too and it does mention what Jack has said to be true.
ROTFLMAO @ Prodigy

Post by frootee // Feb 26, 2009, 7:02am

frootee
Total Posts: 2667
pic
Thanks trueBlue. I'll read it. :)

Post by TomG // Feb 26, 2009, 7:20am

TomG
Total Posts: 3397
There is something very close to a hole though, that it does support - see attached image. These are n-gons, but slightly more than that since they loop around. It would be possible for triangulation to connect across the "hole" and so invalidate the geometry. But it's not a full hole in the sense of floating edges in the middle of the face.


These are not currently loading correctly via Jason's plugin, and such faces do exist from SketchUp Pro exports to OBJ.


Note that exporting via LUUV triangulated to remove holes, so you can't save an object from tS to OBJ and have that kind of geometry. However, SketchUp Pro is not triangulating the OBJ on export, which leads to quite a bit of work needed in tS to tidy up if you import via LUUV or the tS6.6 File menu.


The LUUV exporter would triangulate and tidy up, but seems SketchUp Pro doesn't do this and leaves these faces untriangulated. While tS doesnt mind such faces once it has them, it seems to cause problems for OBJ importers. I don't have SketchUp Pro myself to test however, and am just going on some test buildings I have - if anyone can create similar objects (or even try making something with a hole in SketchUp), then I'd be interested to see those objects, as would Jason I am sure!


I'm hoping we can get this new workspace OBJ importer working with this kind of object in a way that beats the existing options :)


HTH!

Tom

Post by jamesmc // Feb 26, 2009, 8:50am

jamesmc
Total Posts: 2566
I don't know if this is the kind of 'hole' you mean, but there is definetely a hole in sketchup - red brick interior.

When exported from the free Google Sketchup with the OBJ exporter, the hole is closed.

1 attached Zipped OBJ file

Note: No texture export from this version of free sketchup OBJ exporter.

Post by jamesmc // Feb 26, 2009, 9:04am

jamesmc
Total Posts: 2566
Here's a Hexagon booleaned object exported as OBJ.

Image from hexagon and zip file of OBJ

tS makes a triangulated mess of it. :D

Post by marcel // Feb 26, 2009, 9:32am

marcel
Total Posts: 569
pic
I don't know if this is the kind of 'hole' you mean, but there is definetely a hole in sketchup - red brick interior.


When exported from the free Google Sketchup with the OBJ exporter, the hole is closed.


1 attached Zipped OBJ file


Note: No texture export from this version of free sketchup OBJ exporter.


No problem to have the hole in TS from your obj . Just another "trick" ;)

Same problem from the spyfrog thread. I fixed his object without triangulated it.

Post by frootee // Feb 26, 2009, 9:40am

frootee
Total Posts: 2667
pic
Thank You James.

Yes, that's the type of hole we're talking about.

I'm trying to avoid 'filling the hole' on import.


thanks marcel. :)


Froo

Post by marcel // Feb 26, 2009, 9:40am

marcel
Total Posts: 569
pic
I forgot to explain. First erase the face which pass above the hole then connect the hole with the volume with a new vertice. Holes is never a problem. I don't understand why to many people have this kind of problem. :D

Post by marcel // Feb 26, 2009, 9:46am

marcel
Total Posts: 569
pic
You can see the .obj imported wtih the hole is not trianguled in TS :)

Post by TomG // Feb 26, 2009, 10:03am

TomG
Total Posts: 3397
Frootee is writing an importer, and it needs to process the incoming model correctly :) This is why he needs to know about holes, as they change the way tS handles the object. Ideally we want the object arriving without the need to delete any extra faces and similar, should turn up just as it should.


I have had plenty of problems with holes, due to exporting for other packages, eg my supply ship that is up for sale, had to go through a stringent quality approval process originally (before TurboSquid was TurboSquid), and to pass it had to have no n-gons, no holes, since these are not liked by some render engines etc.


And we saw with the boxcar that it can cause render issues to just have the holes. The guidelines you added were just enough to let the program figure out how the geometry was meant to be, which it couldn't do without it (ie it gave it enough extra info that it could perform its own internal triangulations and not end up with a mess). My solutions simply went further in adding tighter controls over how the triangulation would go - how much you need depends on whether you are just getting it to work in tS, or if you are destined for other packages, where long thin triangles can cause normal problems, be treated on import as a degenerate triangle, and more.


If you are just sticking in one package though, then you don't have a problem in general. tS loves holes and n-gons and does very well with them, while some packages don't allow them at all. This means a lot of tS users never need think about it - but it is a real issue, as Frootee on writing the importer is finding out :)


HTH!

Tom

Post by frootee // Feb 26, 2009, 10:08am

frootee
Total Posts: 2667
pic
Yes, I'm finding that out indeed... bah humbug... :)

Post by marcel // Feb 26, 2009, 10:15am

marcel
Total Posts: 569
pic
ok I did not understand that Frootee is writing an importer. this is a good new. :)

Post by frootee // Feb 26, 2009, 10:16am

frootee
Total Posts: 2667
pic
Hm... if long thin triangles cause problems with normals,

then perhaps breaking up that triangle recursively until the ratio of lengths of triangle sides becomes more appealing (thus avoiding tiny normal values) could be useful.

Post by marcel // Feb 26, 2009, 10:36am

marcel
Total Posts: 569
pic
It may be a bad idea but if it was possible to have in memory each group of triangles that form a polygon before the triangulation. after triangulation the plugin combine each group of triangles to do the original polygons.

Post by TomG // Feb 26, 2009, 10:44am

TomG
Total Posts: 3397
Yes, frootee is developing an OBJ importer in workspace :) Working very well, we are now dealing with these more "odd" geometry cases. We have identified they can happen from, say, SketchUp. His plan is to make this pretty much the ultimate importer, so he is trying to account for anything odd or strange that any program might do in creating an OBJ, so that it ends up not only integrated in workspace, but also more complete and easy to use (ie with less repairs) than either LUUV or the tS Model File menu importers that currently exist.


Hats off to his hard work! He is doing a great job. I'm just the one throwing odd objects at him, which makes me feel bad in a sense, trying to find things that break what he has! But it all helps make it stronger in the end, so I guess that's ok.


Thanks for all your work on this though! I know it will be appreciated by many once complete.


Thanks!

Tom

Post by marcel // Feb 26, 2009, 10:53am

marcel
Total Posts: 569
pic
All this reminds me of the time when I developed. I made a 3d soft. But I do not program for a long time. I prefer to be a user for my job. :)

Post by frootee // Feb 26, 2009, 11:40am

frootee
Total Posts: 2667
pic
hehe cool thanks Tom. :)

Well, we'll get it.

Post by Steinie // Feb 26, 2009, 12:10pm

Steinie
Total Posts: 3667
pic
Frootee are you planning export obj too?

Post by frootee // Feb 26, 2009, 12:17pm

frootee
Total Posts: 2667
pic
Darn Right Cat Daddy! :)

Post by Khai // Feb 26, 2009, 12:23pm

Khai
Total Posts: 56
pic
how is this handling the UVmapping?

can you import with out triangulating?

will we be able to export without triangulating?



those are the main 3 things that I'm wondering about... I move models between tS, Maya, Uvmapper and Poser constantly... I need the same model moved as is you see...

Post by frootee // Feb 26, 2009, 12:30pm

frootee
Total Posts: 2667
pic
Hi Khai.

The triangulation on import is what I am dealing with now.

I am not sure whether we can avoid triangulation on import. We'll see.


I have not worked on UV yet.


Exporting without triangulation: I'd like to try. I think that's possible. It's on the list.

Post by Jack Edwards // Feb 26, 2009, 1:29pm

Jack Edwards
Total Posts: 4062
pic
You can definitely do import so that the model will appear without triangulation. The underlying mesh will have to be triangulated (all WS meshes are triangulated), but you do have the original edge list (assuming the face description lists the verts in edge order) from the OBJ file to set the tS edge flags with.

UV is easy, just read in the values, attach the stream. ;) As long as you don't add any new vertices, they already have matching UVs directly from the file.

Post by jamesmc // Feb 26, 2009, 1:34pm

jamesmc
Total Posts: 2566
Would flipped normals cause problems in an OBJ import?

Post by frootee // Feb 26, 2009, 7:14pm

frootee
Total Posts: 2667
pic
Well, I think the faces would still show up, just backwards James. Those could

be corrected by 'flipping' them in workspace.


But what I am seeing with your example scene (thank you very much for the contribution to test btw!) is, there is no triangle face to flip. It's either just not there, or the triangulator made a super thin triangle.


Thanks also Jack for the info! :)

Post by jamesmc // Feb 26, 2009, 7:35pm

jamesmc
Total Posts: 2566
One cube with boolean and triangulated face coming up. :D

Done in hexagon and exported as OBJ.

Post by frootee // Feb 26, 2009, 8:01pm

frootee
Total Posts: 2667
pic
Thanks James.

The importer, as is, does not do a good job of handling this.

What is happening is, some original faces only get 1 triangle.


But since this object is already triangulated, that rules out the issue of not

triangulating Prior to import. At least in this case.


Here's the object.


It may be possible that face normals have something to do with this.

But why would only one half of the face have the problem? Hm perhaps the Vertex normals are playing a role.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2020. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn