K3D Loader features - Axis Swap / MTL Loader

This feature would be on the loader, and swap y and z axis.

I've used this loader in Google Sketchup:

http://forums.sketchucation.com/viewtopic.php?t=20584

... and found the feature to be handy.

In addition, the handling of MTL files with this script is cool. Maybe there could be an Image Structure input on the structure render that is in beta, for loading MTL. Perhaps this could be adapted to work with loading dae texture via this port as well.

cwright's picture
Re: K3D Loader features - Axis Swap / MTL Loader

MTL is more than just an image. Also, OBJ sucks (which MTL is associated with).

gtoledo3's picture
Re: K3D Loader features - Axis Swap / MTL Loader

Yeah. After I started looking inside MTL files (unfortunately, a few minutes after I posted this), I realized why you didn't do this.

...I see why you didn't do the axis swap too, but it seems odd for proper orientation to not be set from the point it leaves the loader. I'm always adjusting x orientation (or other) to get either the K3D or the Apple Mesh to be "in the right orientation". I know that there are transform patches that kind of handle this, but again, there is something aesthetically nice about having the right orientation set so that the loader never outputs "incorrectly".

cwright's picture
Re: K3D Loader features - Axis Swap / MTL Loader

axis swap is trivial, and would be a useful transformer.

gtoledo3's picture
Re: K3D Loader features - Axis Swap / MTL Loader

What do you think about the idea of something like an image structure input for a structure renderer (it being understood that you don't do K3D anymore). I'm just asking that more from the standpoint of "does that make sense to you aesthetically?"

In addition, it "kind of" makes send to me to have stuff like a color port that you could send a color structure that addresses each index of a model; basically any parameter having a "structure input", if it's in a mode where it is rendering a bunch of meshes en masse without iteration (whether K3D, or QCmesh based, really).

It's something that, as I've made different setups, I've thought would allow me to do certain things in a much more straightforward fashion.

I think what fails me, conceptually, is whether I think it makes more sense to just have one big port that receives structure that could address any of these type of parameters (ala GL Quad Struct, or GL Struct Render Environment) or whether a given port type should slip into "structure mode" if a structure is plugged in (nothing works like this currently.) I don't know if that's too much abstraction, but I do think it would be quite "hot" to be able to just plug in an image struct or color struct to a K3D renderer (this is sort of how I think image loading should have worked with QC mesh, especially given the image patch support for structure).

Things like transform, rotate, and rotation origin (rotation origin is especially important), structure would allow animation of basically static models.

gtoledo3's picture
Re: K3D Loader features - Axis Swap / MTL Loader

I know obj is ancient, but why is it that it "sucks"? Is it hard for it to run efficiently?

What do you think is a more optimal format; collada, fbx, or neither?

I guess this is OT, but it might be cool for you to peruse through the forum Google Sketchup forum where they list all of the plugins and ruby scripts. There are many ideas in there that could/should be QC features. It's a really rich community, as far as the addons that have been made.

cwright's picture
Re: K3D Loader features - Axis Swap / MTL Loader

optimal depends on the loader. rendering speed is irrelevant (everything loads the data into the internal k3d format, so MD2 = FBX = OBJ, etc). Only the loader matters. In this case, the FBX-sponsored OBJ loader is slow, and more generally the OBJ format isn't well defined, so every loader will make some compromises.

Obj also allows N-gons (polys with more than 3 sides per face). A bunch of people want this, but that doesn't work so well with OpenGL when you want to render quickly. K3d opted to break these polys down into triangles, but that makes wireframes wonky.

Obj is also text-based, so it's 1) not compact 2) slow to parse, and 3) loses accuracy (saving floats to numeric strings isn't entirely lossless all the time -- it's usually a really tiny error, like 1/1,000,000 of a unit, but it's a needless quality compromise) [actually, it might be possible to do this losslessly, but I don't know how long the numeric strings would need to be -- 6-8 characters?)

smokris has added a bunch of loader stuff that I haven't touched, so I can't make any educated guesses about "best" formats, but FBX and MD2 were the two least troublesome when I was working on it. Collada is XML, so it suffers the size/speed/quality tradeoffs that OBJ does. It has the perk of being well-defined, so a compliant loader can be guaranteed to be correct.

gtoledo3's picture
Re: K3D Loader features - Axis Swap / MTL Loader

When I was asking about best it wasn't so much in relation to QC, but more about the overview that you, did, give. I was speculating that text based stuff (obj/collada), would tend to have less possibility of being as optimal.