MGF converter progress back

(L) [2006/02/04] [Ho Ho] [MGF converter progress] Wayback!

To my suprise I already made a little progress.

Well, actually I personally haven't yet coded a single line of code but I found two tools that can convert geometry from the mgf files to almost whatever format needed.
The first tool was mdflib that I found bundled with radiance. I found it here [LINK http://www.radiance-online.org/software/] The lib itself is in src/cv/mgflib. It compiled perfectly under Linux/GCC 3.4
The second tool was [LINK http://www.scs.fsu.edu/~burkardt/g_src/ivcon/ivcon.html IVcon] that can read and write quite a lot of 3d data formats.

Steps to get .obj from mgf after obtaining those two tools:
1) convert mdf to Inventor format with mgf2inv from mgflib:
Code: [LINK # Select all]# mgf2inv model.mgf >> model.iv
2) convert the resulting .iv to obj with ivconvert:
Code: [LINK # Select all]# ivconvert
(from ivconvert internal commandline)
< model.iv
> model.obj
The result should be all the geometry together with normals in model.obj.


Because I'm not at home right now and I don't have any other renderer but blender I haven't yet checked if the resulting .obj really works or not. When I exported to dxf then they rendered just fine in blender.

Current problems:If one file has several different model instances they are all placed in (0,0,0). E.g in the conference hall scene all the chairs and other stuff is at the same place. If this is a problem with mgf2inv then there is little to do besides to repair that lib. If the problem is in ivconvert then it might be that exporting to other format could be the cause although I doubt it.No other info but vertice coordinates and surface normals are exported. So far it seems that the other data is lost in the second step of conversion. May be when replacing the ivconv with a better converter that data can be savedivconvert seems to remove some data it thinks is irrevelant. From its log it seems it "fixes" faces with >10 vertices. Also it deletes faces that have tiny area. Also there is something called FACE_NULL_DELETE that I think removes faces with no vertices. I think these are probably created by previous "fixing" steps.Some faces have > 3 vertices. That should not be a problem with good obj loader.I converted all the files from conference room to obj and tarred them up. They are availiable [LINK http://hoho.bafsoft.net/models/conf.obj.tar.gz here] (~700k)

I'll try to find some obj and perhaps Inventor importers to blender to see how much and where data gets lost. Perhaps there is no reason to write separate tools for the job.
(L) [2006/02/04] [Ho Ho] [MGF converter progress] Wayback!

To my suprise I already made a little progress.


Well, actually I personally haven't yet coded a single line of code but I found two tools that can convert geometry from the mgf files to almost whatever format needed.

The first tool was mdflib that I found bundled with radiance. I found it here [LINK http://www.radiance-online.org/software/] The lib itself is in src/cv/mgflib. It compiled perfectly under Linux/GCC 3.4

The second tool was [LINK http://www.scs.fsu.edu/~burkardt/g_src/ivcon/ivcon.html IVcon] that can read and write quite a lot of 3d data formats.


Steps to get .obj from mgf after obtaining those two tools:

1) convert mdf to Inventor format with mgf2inv from mgflib:
(L) [2008/07/31] [Darnal] [MGF converter progress] Wayback!

Hi
Just curious to know if you ever got this working, I've been trying to convert the conference room and office scenes from MGF into OBJ. Simpler scenes convert fine (Peter Shirley's test scenes for isntance) and using mgflib I get perfect IV files which then can be viewed but refuse to go into OBJ without major issues  [SMILEY :shock:]  I use Polytrans as we have it at our univeristy but even that doesn't help .. IV to anything goes wrong but then again at least it can be read unlike MGF.
I just wanted to know if anyone has the conference room / office and is willing to share them or at least if someone has a tool-chain that actually works, if not than I'm going to have to dive into the Open Inventor API (which is at least updated and current with a nice C++ interface) and write my own loader from scratch ... to be honest given its only two scenes, although admittedly important ones if one is publishing RT papers, I'd prefer not to have to resort to that  [SMILEY :|]
(L) [2008/07/31] [beason] [MGF converter progress] Wayback!

>> Darnal wrote: if not than I'm going to have to dive into the Open Inventor API (which is at least updated and current with a nice C++ interface) and write my own loader from scratch
I'm quite familiar with Open Inventor API and would be willing to assist you down that path, if you should take it. I have code for reading Inventor scenes in that you are welcome to. If you are extracting triangles and materials it's probably a couple hundred lines. Anyway, just let me know if you are interested.
(L) [2008/07/31] [Darnal] [MGF converter progress] Wayback!

>> beason wrote:Darnal wrote: if not than I'm going to have to dive into the Open Inventor API (which is at least updated and current with a nice C++ interface) and write my own loader from scratch
I'm quite familiar with Open Inventor API and would be willing to assist you down that path, if you should take it. I have code for reading Inventor scenes in that you are welcome to. If you are extracting triangles and materials it's probably a couple hundred lines. Anyway, just let me know if you are interested.
That would be fanastic [SMILEY :-D] I'm seeing issues with Open Invetor files already when trying to convert scenes with primitives other than triangles (regretably I'm limited to using triangles in my renderer) and this is where most of the importers tend to have minor breakdowns and just spit out absolute crap. Basically the conference room scene and office scene are the two that I really want as they are used in so many papers and are essential scenes one needs to have ... and of course both have spheres and cylinders in them. I'd really appreciate any code that would be give me a head start as then at least all I'd have to worry about is covnerting those spheres and cylinders into polygon representations which, while painful, shouldn't be too bad I hope [SMILEY ;)]
(L) [2008/07/31] [beason] [MGF converter progress] Wayback!

Wait... are you saying you have an inventor (.iv) scene with spheres and cylinders and you want one with just triangles? That is super simple.
On the command line:
Code: [LINK # Select all]ivfix input.iv output.iv
Or is it a different problem?
(L) [2008/07/31] [beason] [MGF converter progress] Wayback!

BTW, you need to have inventor installed. You can compile from source or install the ubuntu packages.
Also, if you have binary and want to convert to ascii:
Code: [LINK # Select all]ivcat binary.iv > ascii.iv
(L) [2008/08/01] [Darnal] [MGF converter progress] Wayback!

>> beason wrote:Wait... are you saying you have an inventor (.iv) scene with spheres and cylinders and you want one with just triangles? That is super simple.
On the command line:
Code: [LINK # Select all]ivfix input.iv output.iv
Or is it a different problem?
You are THE man! [SMILEY :-D] This solved the import issue and now all the importers (especially polytrans) love the ivfixed .IV files .. means I finally got conference room into 3DSMAX and I can now export it into anything I want. I owe you many thanks as I've been struggling with this for over two days ... go figure they'd be an Open Inventor expert on ompf   [SMILEY =D>]
Thanks a lot again, I'm off to plug conference room into my renderer to see what it looks like [SMILEY :)]
(L) [2008/08/01] [beason] [MGF converter progress] Wayback!

Woo hoo! Glad it worked out for you. Looking forward to those renders. Good luck!

back