Plea for help from the coding gurus

Blitz3D Forums/Blitz3D Programming/Plea for help from the coding gurus

Kuron(Posted 2003) [#1]
Many in the community have written some great converters and importers/exporters for the B3D format for many of the popular 3D modeling programs.

Could one of you gurus, please consider writing an importer/exporter for AC3D or at least an AC3D to B3D convertor? It only handles static models so it should not be too difficult. It ia a great and affordable program perfect for level design, static models, etc.

www.ac3d.org


fredborg(Posted 2003) [#2]
I'll look into it. May take a little while...

Can you send me a file to test it with?


Kuron(Posted 2003) [#3]
Wozers thanks a million. My email server is down right now. I posted a ZIP on my site with some of the default models (so I know they are made correctly) and in the zip is info on the ac3d format and some sample loader code. Its a 200K zip

http://members.xoom.virgilio.it/bricemanuel/ac3dmodels.zip


fredborg(Posted 2003) [#4]
Alrighty then...I'll look into it in the weekend...

It looks realy simple, so I don't think there will be any problems.


Kuron(Posted 2003) [#5]
You da man!! Yeah, it likely is a simple format. Its the only modeling program my simple mind could ever figure out ;c)


TeraBit(Posted 2003) [#6]
That being said, it seems to support export to a lot of other file formats. Why not simply export to say .LWO and convert that to .B3D?


Kuron(Posted 2003) [#7]
Don't have Lightwave to use the B3D exporters listed on the Blitz site. Also since I do not have lightwave, I have no idea how accurate the LWO exportation is in AC3D. And you and I both know it is best to convert directly to one format to another. Trying to get into a format by going through several conversions usually leaves you with knackered models.


TeraBit(Posted 2003) [#8]
I pretty much agree, but in the interim why not give it a try.

The LightWave Convertor I did doesn't require LightWave, but is a stand alone .exe

It even gives you a preview of the model so you can check how well (or not) it converted.


Kuron(Posted 2003) [#9]
The LightWave Convertor I did doesn't require LightWave, but is a stand alone .exe
Was not aware it was a "converter" ;c)

Still will be nice to see a AC3D exporter or converter for B3D. AC3D is a very popular modeling program. Thank you again, Fredborg.

NOTE to whoever is in charge of the Blitz site. Please correct this mistake on the B3D specs page. Calling a "Converter" an "Exporter" is VERY misleading, as they are used in entirely different ways.


fredborg(Posted 2003) [#10]
Ok, I've got it working pretty well now (I know it's not the weekend yet ;)...

The big question is whether it would be okay, if it only imported triangulated and quad models? Because if it's not then it's gonna take some time, as ac3d allows you to create polygonal models, with no limits on the amount of vertices in each polygon. This means that in order to import these suckers properly into Blitz, I need to run some kind of polygon triangulation scheme (possibly Delaunay triangulation), and it's a bit over my head right now :) As far as I can tell, there is a menu option in ac3d to do this for you...

But if someone can dig up a good and understandable piece of code, that can do 3D Delaunay triangulation, I'll be happy to put it in. I could only find some overly complex C++ stuff, and a 2D Visual Basic example.

I'll post a proper version in the next couple of days, there are still a few things that are a bit off...

PS: Oh, and it's an AC3D to B3D Converter I'm doing :)


Kuron(Posted 2003) [#11]
The big question is whether it would be okay, if it only imported triangulated and quad models?
Yes, that would be fine :c)

head right now :) As far as I can tell, there is a menu option in ac3d to do this for you...
Stupid? What is that menu option called in AC3D? Although I can use the program, I am only using about 1/20 of the features because I don't know what most of them do.

Thank you again for your time and your efforts.


@TeraBit As for your LW convertor, in AC3D, the LWO plugins seem to only be available for the new 4.0 reg version (I am still using the 3.X series which supports less formats). However, I used your convertor on several LW models we used in a commercial game many years ago, and they converted perfectly!


fredborg(Posted 2003) [#12]
Stupid? What is that menu option called in AC3D? Although I can use the program, I am only using about 1/20 of the features because I don't know what most of them do.

Hehe :) It's at Surface->Triangulate, but I just downloaded a demo of version 4.0 so it might no be in your version...


Kuron(Posted 2003) [#13]
Its there, just never knew what it did :cp


bradford6(Posted 2003) [#14]
it says it exports to Milkshape

Milkshape exports to .b3d

also get unwrap3d (www.unwrap3d.com)
it imports and exports tons of formats


Kuron(Posted 2003) [#15]
Re: milkshape. I am still using 3.0 Do not have that ability in my version of AC3D, also I do not own Milkshape. Converting models through several formats like that usually ends up with knackered models. I try to use that method as an absolute last resort as it is rather shoddy most times. Example, I have 50+ MD2 that started out as something else and were converted to MD2 and work PERFECTLY in the old engine I used to use, however they do NOT work properly in B3D and most MD2 modeling programs. They need some serious fixing, but I haven't had the $$ to get somebody to fix them.


Kuron(Posted 2003) [#16]
*double post*


marksibly(Posted 2003) [#17]
Hi Fredborg,

Found this on Delauney triangulation which describes it pretty well:

http://www.cs.cornell.edu/Info/People/chew/Delaunay.html

The idea is the same in 3D, only you use 'tetrahedrons' - 4 sided pyramids with each side being a triangle.

It should be pretty easy to code up but note that it only depends on input vertices - model polys are ignored.


fredborg(Posted 2003) [#18]
Thanks, but I think I have messed up the terms. What I really need is a polygon tesselation algorithm, similar to the OpenGL tesselate function :)

[edit]I think I've found it. Otherwise I'm gonna give it up :) PolyTry with source[/edit]


marksibly(Posted 2003) [#19]
Hi,

Plain old 'tesselate' should be simple enough: pick the longest triangle edge, split it in half and produce 2 output triangles.

But I'm not sure what you need it for so that may or may not be useful!


fredborg(Posted 2003) [#20]
Ok, it's not that kind of tesselation :) Heck, it's hard explaining stuff like this when English isn't your native language. So here is a small sketch to show it:

So basically what I get from AC3D is the outline of a polygon and I need to tesselate/triangulate it into a regular triangle mesh. AC3D uses the GLUT tesselate function to do this internally, so a function similar to that is what I'm looking for. I haven't tested the PolyTry one yet, but I think that will do it.


fredborg(Posted 2003) [#21]
Sweet :) I've got the PolyTry algorithm running in Blitz!

And the great thing is that it works in both 2D and 3D. I'll be popping it into the Code Archives in a short while.

Thanks for the help Mark!


TeraBit(Posted 2003) [#22]
Cooool! If you don't mind I'll add that to my much hassled 'Needs to be triangulated first' convertors!

Mr. Fredborg dies it again!


fredborg(Posted 2003) [#23]
Mr. Fredborg dies it again!
Ohh noooo, I'm dead already?
If you don't mind I'll add that to my much hassled 'Needs to be triangulated first' convertors!
Sure, but I might come knocking on your door for a return favor :)

In the meantime you can play around with this (~430Kb)
Left click - create vertex
Right click - triangulate/tesselate


TeraBit(Posted 2003) [#24]
LOL.. I would edit it, but it wouldn't be as much fun!

:)

[edit]

Hey, that tesselate demo is really cool!

I suppose an optimise function could be created by finding the outline of a coplanar region, then removing the tris and re-tesselating them.


Pepsi(Posted 2003) [#25]
That is pretty sweet, Fredborg! Nice job :)


Kuron(Posted 2003) [#26]
Cool stuff Fredborg! Is there an address we can send flowers for the funeral? :cD


TeraBit(Posted 2003) [#27]
It's a typo I tell you 8D

Reports of Mr. Fredborgs demise have been extremely badly typed...


fredborg(Posted 2003) [#28]
Thanks for your concern, fellas :)

TeraBit: I've been thinking about a way to optimise the triangulation, it goes like this:
For every two triangles with a shared edge
  If shared edge is shorter when turned
    Turn shared edge
  End if
Next
Don't know if it will work without running it a couple of times on the mesh, but it seems feasonable.


Pepsi(Posted 2003) [#29]
I'm sitting here looking at the polytri's source code and looks like this only works when drawing on an infinite plane where Z=0. Am I right? Still studying it...


fredborg(Posted 2003) [#30]
The algorithm works for all planar or close to planar polygons, according to my tests. Regardless of the planes orientation.


Pepsi(Posted 2003) [#31]
Thanks for letting me know, Fredborg. I had stopped studying it in favour of trying my own method out. I think I almost have it done where I can create triangulated polys regardless of plane's orientation also. It may be a bit slower than what you are doing, but I really find this stuff very interesting. I'm working off of edge angles and normal facings. I'll post it when I get it done.


Kuron(Posted 2003) [#32]
*bump* ;c)


fredborg(Posted 2003) [#33]
Hey, hey, hey! I've been super busy with real life stuff, but it's almost done, so don't worry :) It WILL be out within a week!


Kuron(Posted 2003) [#34]
Not worried and not rushing ya ;c) I am very appreciative of your help. Was just trying to find the thread since the forums were condensed. ;c)


TeraBit(Posted 2003) [#35]
I'll be keeping my eyes peeled for the Triangulation code...


fredborg(Posted 2003) [#36]
TeraBit: If you need it desperately, I can send you a fully working version, when I get home tonight. I just wanted to make it a little cleaner for the code archives :)


TeraBit(Posted 2003) [#37]
No desperate rush really. I like squeeky clean code :)