Workspace OBJ Import success

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.

Workspace OBJ Import success // SDK, Plug-in & 3rd Party Area

1  2  |  

Post by GraySho // May 9, 2009, 5:01am

GraySho
Total Posts: 695
pic
Here´s part of my old cathedral. After some boolean operations it got messed up. It should have holes in it, which in tS could only be fixed by triangulating the object. HTH

Post by Stem // May 9, 2009, 5:59am

Stem
Total Posts: 199
After some boolean operations it got messed up.


I have just imported that file into 4 different applications, all with the same result. No windows/holes. Either the model was bad or the output was from whatever application you used was. Was it output from TS?

Post by frootee // May 9, 2009, 8:03am

frootee
Total Posts: 2667
pic
Here it is; imported into TS.

If you either switch to edit mode (right click on the model, convert to editable mesh), or, switch to wireframe view, you can see the cathedral details.

But if you render, you see a couple cubes. Hm...

Post by GraySho // May 9, 2009, 9:01am

GraySho
Total Posts: 695
pic
I suppose your importer works fine, it´s the geometry that´s messed up. Have the same result with LUUV, rendering just cubes.

Post by frootee // May 9, 2009, 10:19am

frootee
Total Posts: 2667
pic
Thanks Graysho.

I have some more work to do on it though.

Post by Stem // May 9, 2009, 11:57am

Stem
Total Posts: 199
Here it is; imported into TS.

If you either switch to edit mode (right click on the model, convert to editable mesh), or, switch to wireframe view, you can see the cathedral details.

But if you render, you see a couple cubes. Hm...


Hi,


I did see the wire frame. There is a need to start removing/editing faces to correct the problem.

I thought you where under the impression that a new importer would correct this on import when I cannot see how that would be done.


I have models that import correctly into all my other applications, but when imported into TS via the LUUV importer the models get broken apart and messed up.

At the moment I am not even concerned about materials or UVs being imported, I just want to be able to get the models in, I will then use TS workspace for mapping/materials.


- Stem

Post by frootee // May 10, 2009, 1:57am

frootee
Total Posts: 2667
pic
No; I thought the term 'messed up' meant it ended up distorted on import.

thanks,
froo

Post by Stem // May 10, 2009, 2:40am

Stem
Total Posts: 199
Hi froo,


The model from GraySho was exported as you are seeing imported. So the model needs work inside the 3d application to correct.



- Stem

Post by frootee // May 10, 2009, 4:44am

frootee
Total Posts: 2667
pic
Thanks Stem :)


I have a question for everyone.

Since I am fairly new to Materials, etc., how important is it to

load a material on OBJ import? I have it working currently, though there

is an issue with grouping. I've heard some apps, like Messiah, don't even import the materials at all.


Do users typically import the OBJ, then add their own materials? Or

do they prefer to start with something with the basic textures applied, which

are defined in the OBJ and MTL files?


thanks,


Froo

Post by Jack Edwards // May 10, 2009, 5:54am

Jack Edwards
Total Posts: 4062
pic
For me I suppose it's important that areas with different materials still end up with different materials. That makes it easy to select by material and re-apply the material I want.

But it's not important to match the actual material exactly on import since each application has a different system for materials and they'll render differently depending on the render engine used anyway.

Post by frootee // May 10, 2009, 5:58am

frootee
Total Posts: 2667
pic
Ok thanks Jack.

BTW I found the problem with groups.

I fixed this before; apparently during a merge I blew away some code;


I tested a cube: 12 triangles right?


Well, with group option selected, I ended up with a triangle count of 9,424.

Something is not getting initialized. I'll fix it. :D

Post by frootee // May 11, 2009, 10:33am

frootee
Total Posts: 2667
pic
found another problem with faces that appear to fail triangulation, where LUUV succeeded.


LUUV is able to allow a non-coplanar face to be added to the mesh. On the Workspace side, triangulation is required, since internally, all faces are composed of triangles/triangle streams. The triangulator fails on non-coplanar (twisted) faces. This results in missing faces in the imported mesh.


The simple (and only) solution to this is, triangulate the mesh prior to import. That guarantees all verts on each face are coplanar. Just a heads up if you run into this (after the importer is released).


In the picture, I'm trying to show the area you can 'see through'. That's the face that failed triangulation. THis area is twisted/noncoplanar.

Post by frootee // May 11, 2009, 2:03pm

frootee
Total Posts: 2667
pic
Maybe I can compensate for that. I'll give it a shot.

Post by Jack Edwards // May 11, 2009, 6:03pm

Jack Edwards
Total Posts: 4062
pic
"There is no try. Only do or do not...." :p

Post by frootee // May 12, 2009, 11:34am

frootee
Total Posts: 2667
pic
Solved.

I use the SDK triangulator. When there are LOOOOOSER faces, I use Jack's algorithm and triangulate the faces into submission.


Problem is, if a face is not planar. If it fails, I just triangulate 'manually' in code, so to speak; i.e., don't use the SDK triangulator.


Anyway.


Dialog is now modal, so only one instance at a time.


Working on resolving autofacet normals today. Capability is there, but I have a weird bug; a flag is not getting cleared.


Couple things left:


1) a pretty icon, not that smear I did.


2) some faces are flipped. Only 1 or two.


materials: choose the right d3d material; yank out unnecessary fluff.

Post by Jack Edwards // May 12, 2009, 1:28pm

Jack Edwards
Total Posts: 4062
pic
Haha, smack down those looooser faces! :p

Modal is a good choice, that should solve the issue Tiles found related to the dialog going behind the main window as well.

Post by frootee // May 21, 2009, 3:24am

frootee
Total Posts: 2667
pic
Ok this one's just about finished.


Prodigy created a much cleaner d3d material for the MTL files, so I'll be using that.


Last thing:


Materials and grouping. I tried creating a material node, and just copying that into each group encapsulator. Not much luck yet with that.


So, I'll try to see if I can get material instancing working, though that may be a bit hairy. Barring this, I have something else up my sleeve.

Post by Jack Edwards // May 21, 2009, 3:38am

Jack Edwards
Total Posts: 4062
pic
Not much time left to get your plugin out, since there will only be a large influx of users over the next few days. You might want to save the material instancing for a future patch/version. :o

Post by frootee // May 21, 2009, 3:45am

frootee
Total Posts: 2667
pic
ok; currently, materials don't work with groups.

suggestions? Release as is?

Post by Jack Edwards // May 21, 2009, 4:01am

Jack Edwards
Total Posts: 4062
pic
Ah I see, depends on how long it takes to fix. ;)

If you can get it done today, I think you should shoot for releasing tonight or tomorrow morning. Have you thought about a distribution method? trueSourceShop.com?

Post by frootee // May 21, 2009, 4:08am

frootee
Total Posts: 2667
pic
well I think I see what I can do.

The fast solution is not the most efficient, but it will work.

I'll have to read the MTL file for each group. Maybe not that big of a deal but I will have to load the D3dmaterial.RsObj for each group. So if I have 1,000 groups then that file gets loaded 1,000 times. Oh well. May not take that long but, well, it's hairy. We'll see.


Basically I have a function called ProcessMtlFile().

Rather than add the material node to the main encapsulator, I can pass an encapsulator pointer: either the main encaps, or a group encaps. Minor modifications required. Busy day though; I'll try to get it done.

Post by Jack Edwards // May 21, 2009, 4:13am

Jack Edwards
Total Posts: 4062
pic
Heh, that'd be a crazy OBJ file.... :p

Sounds like you're on the right track! Good luck! :banana:

(So this means I can resume working on my FBX importer now right? ;))

Post by frootee // May 21, 2009, 4:27am

frootee
Total Posts: 2667
pic
yes, please carry on; don't let me hold you back!
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn