.obj file to jit.gl.nurbs
Hey everyone.
I'm working on a small set of tools to pass obj files around, operate on them, display them, etc. I'm working with a bunch of architects who work in Rhino, so we've been doing alot with the jit.gl.nurbs object.
Up to now, smooth sailing. I can get jit.gl.nurbs outputting obj files. But if someone hands me an obj file, I can get all the control points into jit.gl.nurbs using an edited version of what I found in this thread: https://cycling74.com/forums/index.php?t=msg&goto=130767&rid=0&srch=obj+nurbs#msg_130767 but they do not connect to make any surfaces - they are literally just a collection of control points in the outline of the obj.
Before I spend my time going deeper into iterating through an obj file and parsing it into a matrix to use as a ctlmatrix for jit.gl.nurbs, I thought I'd ask if anyone had any tricks up their sleeves for this kind of thing, or a list of stuff to watch out for. Or maybe admonition for this just being a silly thing to try to do, and suggestions for a better way to operate on the guts of an obj file in Max?
In a post from a while ago, JKC had this to say:
*Note that Jitter currently only supports OBJ files that are triangulated meshes. While the OBJ spec has support for NURBS surfaces and other types of parametric surfaces, you will need to force the output OBJ to be tesselated triangles for Jitter to use it.*
which I only partially understand. So. Any help is appreciated.
it sounds like you have a pretty good grasp of what you're doing, do i don't think i can offer much help.
i believe what joshua was referring to was jitter's jit.gl.model object. this object will only load .obj files that contain mesh information, which is basically a list of triangles that creates a surface. i had no idea .obj's even supported nurbs, but apparently they do. nurbs are not triangles, but curves.
you can parse your obj files however you want, and do whatever you want with that information. if you have a .obj that contains nurbs info, it's up to you to translate that into a controlmatrix for gl.nurbs object. all he's saying is you can't use gl.model to automagically load it for you.
i'd be interested to hear what you come up with.
-rob
Yeah I kinda figured it out the hard way: I'm beta testing Rhino for mac and the export .obj as a tesselated mesh (instead of NURBS) function is broken - jit.gl.model gets an "out of memory" error upon trying import a NURBS .obj.
Then again being beta it could probably also be 1,000,000 other things.
I tried some stuff parsing the output of jit.gl.model's matrix into jit.gl.nurbs but nothing seems to translate right. Even simple stuff like a 16 point square (2D, not a cube) doesn't come out right. I thought maybe jit.op was the secret but no luck yet. I'll keep pluggin'.
Thanks for the encouragement - I'll show and tell when something cool happens.
> I tried some stuff parsing the output of jit.gl.model's matrix into jit.gl.nurbs but nothing seems to translate right. Even simple stuff like a 16 point square (2D, not a cube) doesn't come out right. I thought maybe jit.op was the secret but no luck yet. I'll keep pluggin'.
completely different methods of rendering. again, gl.model is triangles, gl.nurbs is curves. if you want to do something with the matrix output of gl.model, send it to gl.mesh.
here's an example...
Yeah I realized very soon after I posted that was not going to work. I did some more research on the .obj spec (mesh obj and nurbs obj). I've learned the following:
•Iterating through an .obj file of a simple shape exported from Rhino using the NURBS spec and loading it directly into jit.gl.nurbs ctlmatrix works... but:
•Complex shapes exported using the same method contain information which - as far as I can tell - has no place in a jit.gl.nurbs ctlmatrix. I've attached an example of one such NURBS obj file.
•The same complex shape exported as a meshed obj file will load just fine using jit.gl.model
Which gets me to your cool, and probably very helpful, suggestion to use jit.gl.mesh, Rob - but I feel like a dolt: I can't for the life of me get any useful matrix data out of jit.gl.mesh. I'd assumed it would be a matter of associating a named matrix with jit.gl.render, but I guess I'm wrong...?
I hate to ask for some "spell it out for me" help... but I think I'm about there. Blast.
Jitter and Rhino (maya, max, other)
mike, rob....
I too am interested in communicating 3D data between jitter and rhino... both importing and exporting using nurbs, tesselated geometries, or IsoSurface. I understand basic concept of importing obj as tesselated surface to jitter.
I would like to be able to manipulate 3D coordinates (of obj, isosurface, etc) in jitter and export the data back to rhino. Do either of you have any suggestions for doing so? Successful examples or trials thus far?
Thank you,
kcam
I've been busy the last couple weeks on a residency, so this has kind of pushed to the back-burner for now, but in the next couple weeks I'll be retackling this - hopefully with some fresh eyes.
Last week, I did find this though:
The toolkit which Rhino uses to read and write 3dm files is open source.
mike...
any progress on transporting data between rhino and jitter?