Wednesday, January 26, 2011

Convex Hull Dilemma

As i haven't found any good function in 3D Studio Max to generate a convex hull, i had to do it on my own if i really wanted it. So i did do some research and stumbled over a nice java applet demonstrating various convex hull algorithms. Excellent!

I at least understand the java source code, so all i have to do is port da shit. It wasn't all too easy, as it needed quite some rewriting thanks to the OOP-unfriendly MaxScript, but finally i got it working.

And that way i found a problem with the algorithm implemented like this: The moment where four outside vertices are on the same plane and part of the hull, you run into the following problem: When you test one vertice against the other three wether he is "outside" and therefore part of the hull, he tests positive. Yet all the other four vertices do that too! So the code ends up looping through the edges of those four vertices for ever...

As the applet only creates random vertices to test and doesn't try geometrical primitives like for example boxes, this problem pretty much never occures. And the moment i shake up those quad-vertices, the algorithm works excellent.

I only tried gift-wrapping so far, so maybe the other algorithms don't have this problem, but my feeling is they do too... At least in some or the other way...

That means i have to adapt the algorithm for a more rigorous edge-filtering.

Friday, January 14, 2011

You are the Sony of my life...

Brilliant. Now i got this beautyful ID-tag for my Playstation Online account additional to my XBox Live account tag here on my blog. But what do my patriotic eyes have to see? The german flag next to my nick! Blasphemy! "This witchcraft can't go on!" i said to myself naively believing in the power of online support. Alas, Sony once again disappointed me, the online support is pretty shitty. I couldn't find any way to email them my sorrow and i had a hard time finding the support forums on the site. I didn't expect to find anything flag-related there, but at least there was a thread about ID-tags... Great! Lets post there! And again Sony managed to drown all my hopes, the moment i tried to post, the "Sony Network integrity indicator" changed from "fully working" to "not really doing all too much"... ARG!

Sorry, Sony, i hate to break this to you as i loved the PSOne and the PS2, but seriously: MICROSOFT KICKS YOUR SORRY ASS AT GAME CONSOLE BUSINESS!!! And thats a shame.

Wednesday, January 05, 2011

FBX Exporter, Quo Vadis?!

I'm trying to script the 3D Studio Max intern FBX exporter. The Manual seems to be pretty straight forward. And also when i set and query various values of the exporter, everything seems fine. So i thought i'd be cool writing my own little toolchain around it, as the unit system in 3DSMax can surely be a major pain in the ass. Oh naive me, of course nothing ever works in 3DSMax as described for sure. Take a look:


units.SystemType
#centimeters
FBXExporterGetParam "ConvertUnit"
#cm
exportFile fbxfile #noPrompt selectedOnly:true
true


Typing this, my object is exported with a scale of 100.0. Why? I don't know. Maybe the exporter assumes for some unknown reason that the scene system unit is meter? Well, lets put it to a test:


FBXExporterSetParam "ConvertUnit" "m"
OK
FBXExporterGetParam "ConvertUnit"
#m
exportFile fbxfile #noPrompt selectedOnly:true
true
FBXExporterGetParam "ConvertUnit"
#cm


Aha! Exporting the file resets the exporters settings to default even though stated otherwise in the manual:

Note When you export or import files in MAXScript, use the command #noPrompt to prevent the FBX Exporter/Importer user interface from appearing during the process. For example: ImportFile “C:\test.fbx” #noPrompt. If the UI appears before an export or import command executed through MAXScript, the last used preset is chosen, and effectively ignores any recent scripted changes.

Now this is simply brilliant! With other words i have no fucking influence on that exporter! Lets try a workaround:


units.SystemType
#centimeters
units.SystemType=#meters
#meters
units.SystemType
#meters
exportFile fbxfile #noPrompt selectedOnly:true
true
units.SystemType
#meters


That must do it, right? No. No change at all. Really? Not even the system units are influencing that thing?!

Final word: I solved it by just scaling the object down before exporting. This way it works. Dumbfuckstupid Autodesk shit, seriously...