FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

free scripts, plugins, models, textures
User avatar
Tiles
Master Chief Petty Officer
Posts: 401
Joined: 27 May 2009, 08:34

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Tiles »

Seems that i have hit a vital part again, heh. Sorry :)

Well, i know the Obj file format just a little bit, just enough to know what does what. And i know no real programming language besides a bit Javascript from Unity. So all i can give is some food for thought. Most probably not of real use :)

That said, when you have four edges, and you end with seven vertices, then there could be something wrong with the indexing i guess. Obj can reuse vertices. That`s where it is different from let`s say X, which writes its own vertices for every face. Another thing is seven less four makes three, and that`s a tri. Maybe that`s another hint, one tri too much somewhere?

What is also interesting is that you write tris out of a obj file that is made of quads. The vertices/face index is already quadrified. One line one face. So from my point of being a noob all there is left is to read the faces index and its corresponding vertices position as they are written in the Obj file. But i guess it`s not so easy because at one point you have to convert it to the truespace internal mesh handing, which works with tris, right? Well, was worth a thought ...

Another thought, Blender has a proper working Obj Im- and Exporter. And it is open source. Maybe you could have a look at how they handle things there?

And last but not least, as you already have mentioned, maybe it is not your importer, but a problem at trueSpace end?
Free Gamegraphics, Freeware Games http://reinerstilesets.de
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

Hi Tiles.
I just posted a message; it's the last one on page 3.
Although my code correctly generates no more than 2 triangles per face
on import, and I see in the obj file which I exported, that there are no more
than 4 vertices per face, trueSpace decides to create NGONS out of
the data that I provide.

thanks

Froo
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

So, with all that being said, ... :) :ugeek:

The obj importer reads each face, and generates triangles for that face:
one or more. Each triangle is added to the triangle stream.

Once all faces have been processed, and all triangles added to the
triangle stream, the obj importer puts this data on the output mesh
connector. That's when trueSpace gets it.

At this point, I am pretty sure that trueSpace makes faces out of the
triangle stream. I don't think the obj package has anything to do with that.

And that is where we are, at this point in time:
the obj package does its job, but there are new features that would be good
to have.

So. There are two ways this can be approached. Both offer the same solution.

If I enable topology operations (finding two triangle 'faces' and combining them
into a 'quad'), I can analyze the mesh and make quads. That's the primary solution.

As far as implementing that solution, it could be done either as part of the obj
package, or as a separate plugin.

Remember how David (trueBlue) showed us how to quadrify faces? I was hoping
we could do that, after obj import. I still can't seem to get that to work btw.
I tried in 7.61 and it does not work. I must be doing something wrong.

Bottom line is, the obj package is doing its job, but trueSpace is making NGons
out of the data the obj package provides. So, additional processing is required
to get it the way we want. Whether that is done as a separate plugin, as part
of the obj plugin, or just using the quadrify tool (if we could get it to work!).

trueBlue, could you offer a step by step approach to using that thing? Quadrify?
I'll try again but I don't know what I'm doing wrong.

Ok; I'm done for now. :)
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Draise »

Cool! Thanks much, it's a very handy plugin!
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

You're welcome Draise.
I am glad it is useful.
Froo
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Draise »

Ah.. how do you import polygonal objects? Like.. without it triangulating?
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

Hi Draise.
Internally, trueSpace handles all polygons as triangle sets.
I think this question came up before. Steinie, Tiles, and some other
folks reported the issue. I don't think it is something I can fix.
At least, not in the near term.
User avatar
Tiles
Master Chief Petty Officer
Posts: 401
Joined: 27 May 2009, 08:34

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Tiles »

Hm, the bridge transfers quads. So there must be a way to tell the workspace not to "use" tris. (of course it still uses tris internally in the underlying geometry)

Draise, when you need proper Obj im and export with quads, then the Modeler is your best bet at the moment. The internal Obj im and exporter is flawed, but the LUUV Plugin does a good job here. You just need to load the LUUV plugin. It comes with tS.
Free Gamegraphics, Freeware Games http://reinerstilesets.de
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

I have to say, Tiles is correct, Draise.
About the one thing I could try, is to not use the triangulator class
that is available in the trueSpace Workspace SDK (Software Development Kit).
The one thing I have always found odd is, some faces give me the wrong number
of triangles, when the face is triangulated. The developer said that should never
happen, but it happens a lot. Or, my code is 'backwards' somewhere. It's very
complex, so it takes a significant amount of time to invest, to isolate the problem.
I haven't had the time required to really spend on it so I had to put it down.
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Draise »

Hmm.... sounds awfully complicated. I eventually used the LUUV plugin to import the obj on the model side, as it's quite accurate, as mentioned!.... Later I saved a rsobj to then use in Rosetta.
I'm liking rosetta, and this plugin, as it exports polygons (surprisingly flawlessly) and UV's quite nicely. But to import anything, you have to do a few more tricks....

I think I'm gonna switch to the FBX importer thread, as it looks promising. I just don't know how to not crash TS when using it!

And TS exports directX files well, how come it doesn't import them? Is there a way?

(Oh why oh why am I not rich so I can pay people to develop stuff!? One day, oneday.. I'd give yous a job! :D )
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

Heh thanks for that Draise. :bananacheers:
It seems there's not much interest anyways; so trying to fix
the OBJ package is not an efficient use of my time.
I want to make some simpler things though.
And, I need to help a friend out with some testing anyway. :)
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Draise »

Sounds good! Yeah, migrated back to the workspace/model version and expanded clintons LUUV script in workspace side to work with a button on the workspace side, so I don't even have to switch sides to get my polygonal obj into workspace. I only copied his script to the "Kernel root/Scripts/Custom Commands/" then made a little button with all the stuff.

It's cool someone attempted to it. I think if I make a convincing product here with TS, maybe I can start up a latin and south american movement to develop this software. Doors are opening here. Tho it may have to start with south american wages...... BUT I like the ease of use and it's concepts... Other programs sometimes lack, this was certainly ahead of it's time, and potentially still can be. =)
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

Good.
I just feel disappointed that it does not work as well as is desired.
There is too much triangulation going on. At the same time though,
it appears there are not many trueSpace users. So that kind of
defeats my motivation for reworking it. I posted the source code some
time ago, so if someone has more time and energy (and know-how)
to get it done, they are more than welcome.

There are a couple areas to look into. Reading the data from a file is
not one of them. That's easy. :)
The problem (i.e. where I think the code needs rework) starts when
the face is projected onto a plane. The plane itself has to be determined;
it's not as simple as x, y, or z. Once that's determined, then the face can be
projected. Then, this 2D representation of the face is loaded into a
Caligari-provided triangulator. That's another class which I have doubts about.
I have doubts because, when I load the vertices counterclockwise, oftentimes
the triangle count is wrong. I know to expect: NumVerts - 2 triangles. Often,
the triangle count is less than that; usually off by 1 or two. In that situation,
I reload the triangulator, with the vertices in the Clockwise direction. That usually
works. But, sometimes even that fails and I have to revert to a brute force method.
The developer indicated, that I should never have this problem. But, I strongly suspect
there is a bug in there.
Why?
The triangulator is supposed to handle faces with 'holes'. I think that algorithm has a
flaw.
I considered investigating/researching triangulation methods and just doing my own.
Maybe I will still do that, because this is a Thorn In My Side. But, I figured, the developer
is waaay smarter than me. Then again, they were on a very tight schedule and some
things were left, unfixed. So. I personally believe the triangulator algorithm has some
serious issues.
So there you go. :)
User avatar
Finis
Captain
Posts: 5410
Joined: 21 May 2009, 18:26
Type the number ten into the box: 0
Location: America!

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Finis »

I intend to migrate to other 3D software since TS will eventually fade away. That doesn't mean that I don't like TS as much as all the TS users here or that I won't use it at all. Most of my pictures are made with TS only. I don't currently know how to use any other modeling software except specialty generators, like Plant Studio, to support TS. So don't take the following as a anti-TS thing.

Also note that Draise and several people here do have, and use, other software including the expensive stuff. (Some of those folks can probably afford that ... others ... hmm ...) They still find TS good for some things but usually not as their main 3D tool.

The effort invested by some to fix or use TS's broken or unfinished parts amazes me. Yes the various user interfaces* of TS are great but why not expend the effort on learning software with a future instead of on giving CPR to a corpse? It just seems that effort is being applied in the wrong places.

The high speed graphics card based rendering is appearing all over the place in other programs. TS and Roman were ahead of the others on that but it will mature in the other programs.

*For those who can't live without "the" TS interface: Which one? Everyone says how great "the" interface is but we are using at least 3 user interfaces with TS. Some like the workspace, some like the 3D widgets of model side, some (like me) use model side's icons and menus and not the widgets.
I prefer dangerous freedom over peaceful servitude. -- Thomas Jefferson/Jean Jacques Rousseau
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Draise »

Hmm.. Maybe I'll start a new general discussion thread about GPU renders and stuff. =P

vi ... f=4&t=3078
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

Well that is what I was struggling with some time ago, Finis.
Was it worth the effort of trying to 'fix' things?
That's also why I dropped the Nurbs tool. What was the point? :)
There are many other tools out there that do the job very well.

Cool Draise
User avatar
Tiles
Master Chief Petty Officer
Posts: 401
Joined: 27 May 2009, 08:34

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Tiles »

Blender is a nice bet for hobby developers. It has all the thinks where tS lacks, like a working bones system, fluids, etc. . It has a superbig community. And lots to do to make folks happy. And it is open source.

The only really weak side of Blender is the poly modeling. I tried to model in Blender, and it was a pain. You can feel the missing N-Gon support at every corner, especially at the tools. Polymodeling is the thing that keeps me at trueSpace. That`s where tS is still miles ahead. And i fear it will last that way some more time. Bmesh is still not in the trunk, heh.
Free Gamegraphics, Freeware Games http://reinerstilesets.de
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

I like the 'open source' aspect of blender. I am still interested in experimenting with a fluid
simulator. The code is there for the blender fluid simulator, so I could learn a lot by
studying that code. Or, just have fun making fluids. :bananacheers:
v3rd3
Lieutenant Commander
Posts: 1191
Joined: 21 May 2009, 20:04

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by v3rd3 »

froo I am using VS 2005 ... do I need to include ATL in the project set up?

Don't get too excited I just want to have a look and see what I might learn.

Tah
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by clintonman »

Draise wrote:Sounds good! Yeah, migrated back to the workspace/model version and expanded clintons LUUV script in workspace side to work with a button on the workspace side, so I don't even have to switch sides to get my polygonal obj into workspace. I only copied his script to the "Kernel root/Scripts/Custom Commands/" then made a little button with all the stuff.

It's cool someone attempted to it. I think if I make a convincing product here with TS, maybe I can start up a latin and south american movement to develop this software. Doors are opening here. Tho it may have to start with south american wages...... BUT I like the ease of use and it's concepts... Other programs sometimes lack, this was certainly ahead of it's time, and potentially still can be. =)
I didn't create the luuv script for workspace.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by clintonman »

froo wrote:Good.
I just feel disappointed that it does not work as well as is desired.
...
...
I considered investigating/researching triangulation methods and just doing my own.
Maybe I will still do that, because this is a Thorn In My Side. But, I figured, the developer
is waaay smarter than me. Then again, they were on a very tight schedule and some
things were left, unfixed. So. I personally believe the triangulator algorithm has some
serious issues.
So there you go. :)
I know how you feel and I'm considering doing the same thing, control triangulation for ngons import(or maybe it was export)(maybe both? It's been a while). Someone mentioned using Blender code as a basis, but Blender is limited to tris and quads so it may not help with ngons. In any case I'll let you know what I find out.
Clinton Reese

http://clintons3d.com
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by Draise »

I didn't create the luuv script for workspace.
Huh? :o But I thought....

:shock:
Capture.PNG
Capture.PNG (93.41 KiB) Viewed 3487 times
You didn't do this plugin? I must have mixed the names up.

oops! :oops:
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by clintonman »

Draise wrote:
I didn't create the luuv script for workspace.
Huh? :o But I thought....

:shock:
Capture.PNG
You didn't do this plugin? I must have mixed the names up.

oops! :oops:
I'm Clinton Reese. :)
Clinton Reese

http://clintons3d.com
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by froo »

v3rd3 wrote:froo I am using VS 2005 ... do I need to include ATL in the project set up?

Don't get too excited I just want to have a look and see what I might learn.

Tah
I don't think so v3rd3.
Open one of the RsExamples plugins, and take a look at a couple of the project settings to be sure.
ATL may be handy, but not necessary, I don't think.
v3rd3
Lieutenant Commander
Posts: 1191
Joined: 21 May 2009, 20:04

Re: FREE OBJ IMPORT / EXPORT FOR WORKSPACE PKG

Post by v3rd3 »

kk thanks froo

Return to “Repositorium”