jit.gl.model, keep mesh coherent when applying vertex manipulations?

    May 31 2014 | 10:13 am
    Hi there,
    I have an issue with manipulating imported 3D models. I want to do vertex manipulations on them, using matrixoutput. The issue is that it seems that the models I create in Maya - or the way jit.gl.model interprets them - is that meshes are built up of triangle faces, and each triangle has its own 3 vertices. This means that every mesh vertex actually has 5 or 6 vertices at that position. One for each triangle that joins in that point.
    Now when I do operations on the vertex matrix, for example adding noise to it, these vertices in the same position split up. The patch below demonstrates that. When I add noise I'd like ducky to deform but keep mesh connected. Though what happens is that the individual triangles disconnect in a kind-of explode effect. That's because the triangles don't share vertices in a triangle-trip fashion.
    How can I prevent this from happening? Is it an export setting in Maya (I = modelling noob)? Or can I do something in Max?
    Tanx for all help, Dtr

    • Jun 01 2014 | 11:35 pm
      (Not behind the computer right now) Try the same technique on a basic jit.gl.gridshape and see if you get the same results. Eg. jit.gl.gridshape @shape plane or @shape cube
      When I export models from blender I use the triangulate modifier and everything seems to displace fine without exploding into separate faces. With jit.gl.render @draw_primitives triangles
    • Jun 02 2014 | 10:39 am
      Thanks for chiming in. The transforms work fine with gridsphape and other geometry generated in Max.
      I got some Maya tips from friends telling me to merge vertices before exporting. Didn't help.
      What file format do you export to from Blender? Could you perhaps give me a Blender generated model that I could test with?
      I'd be happy to switch to Blender if that solves it. Need to learn modelling from scratch anyway.
    • Jun 02 2014 | 2:25 pm
      Just download blender. Add a cube. Use a subdivision surface modifier then a triangulate modifier
      Export as a .DAE file with the settings in the screenshots.
      Because its exported with the modifiers applied then you can do none destructive editing and always go back and alter the geometry.
      Always check that you merge double vertices. And with jit.gl.model I turn off some option which allows jitter to change the vert order. Not sure what it is anymore.
    • Jun 02 2014 | 5:44 pm
      And with jit.gl.model I turn off some option which allows jitter to change the vert order. Not sure what it is anymore.
      possibly @optimize ?
    • Jun 02 2014 | 5:46 pm
      Just looked it up, thats the one Rob ! If thats off then you know that the vertex order is exactly "the way " it should be.
    • Nov 17 2014 | 6:16 pm
      Has anybody solved this? I tried changing the jit.gl.model to @optimize 1 and the triangles still become detached when noise is added. I too want to warp vertices and have to mesh not decompose into individual triangles.
    • Nov 18 2014 | 8:35 am
      A colleague helped me with this. He merged vertices in the 3D modelling software (Rhino?) before importing into Jitter. I don 't know enough to be able tell you the details of what and how exactly. Sorry. I know it was finicky and took a while before he found what exactly worked.
    • Apr 22 2015 | 12:03 pm
      hello Andro...
      i give a try to Dtr patch and im having the same result, when noise is added using his patch, the mesh is broke in disconnected triangles...
      i follow you suggestions about Blender exportation but the only thing i don't found in Blender is; how to merge double vertices?
      i tried too optimize 0 and 1 and the result is the same...
    • Apr 22 2015 | 5:10 pm
      Hi Carsol,
      Do the following. In blender press tab ( edit mode) Press a ( select all vertices edges and faces) Press t ( transform menu) Click remove doubles.
    • Apr 22 2015 | 5:39 pm
      eii Andro, my dear blender friend aahaha... ye ye is what i did and tried now again and the objects breaks in tris....
      as you said, doing this: Add a cube. Use a subdivision surface modifier then a triangulate modifier select all Remove Doubles export DAE (with the settings of your screenshot)
      and then with DTR patch the vertexs of the object remains connect when apply the noise????
      in the image what i get, object broke in tris..
    • Apr 22 2015 | 8:10 pm
      No Clue Carsol. I'm pretty sure that if you get a model in blender ( a cube) export it (lets call it model A) go into edit mode and do a few simple changes to a few verts, export it as model B Load them both into jit.gl.model @matrix output 1 send both outputs to a jit.xfade. If you crossfade it should go smoothly. So why this happens with noise being added to the verts is a mystery to me, Never solved it myself :(
    • Apr 22 2015 | 11:16 pm
      I think the best workaround I've come up with is to use UV coordinates to look up the distortion (noise) value instead. I've done this using jit.gl.shader with a vertex program that did a texture lookup into a noise texture, and I've used jit.gen to do it. The good thing about that way is that you know that all the copies of the same vertex will have the same UV coordinates, so it will keep the triangles together. Texture coordinates are also a 2D space, so it's easy to reference matrix/texture coordinates with that. The downside is that you must actually do some UV mapping in your modeling app to make it work properly.
      Hope that helps.
    • Apr 23 2015 | 1:34 am
      I know some of those words.
    • Apr 23 2015 | 8:03 am
    • Apr 23 2015 | 8:09 am
      @Andrew: While that sounds, well... sound, do you have an insight to share on the cause of the vertices splitting? Is it perhaps because even though we tell our 3d modelling programs to join the vertices they're still written to file multiple times and subsequently read into Max?
    • Apr 23 2015 | 12:49 pm
      DTR: Theres a post in this topic where you mention that a friend of your did and object that dosent broke... :-?
      Andrew: heheh... happens the same here, i understand the words but no clue how to start implementing your technic...
      besides this, its a pity that jit.gl.model isn't able to merge vertices that are in the exact same position, when i found this topic i thought optimize=1 was the solution because i always set it to 0. From the reference: Optimize vertices and nodes on import (default = 1). An optional post-processing step when importing the model file. >>>>>>>>>>>> Identical vertices are jointed to optimize indexing <<<<<<<<<<<<<
      if we could merge the indentical vertexs, then we will be able to deform the mesh, but don't looks like the identical vertices are jointed with optimized=1, no?
    • Apr 23 2015 | 1:59 pm
      Well last month I was working on this project again and I couldn't find the mesh files that were supposed not to split. I think I confused it with another deformation I have in this patch. All of the files I had were breaking up when adding noise.
    • Apr 23 2015 | 3:55 pm
      jit.gl.model draws triangle meshes, which means every vertex in the model file is a unique vertex of a unique triangle. if you want two adjacent vertices from distinct triangles to stay joined, you must multiply them by the same amount.
      andrew's technique, while brilliant, is probably a little less complex than it sounds. here's a basic working example using the duck:
    • Apr 23 2015 | 5:31 pm
      LOL, yeah, thanks Rob for banging that together. That's exactly what I meant, but expressed in over-wrought language. It's a case of a simple idea that starts sounding really complex as soon as you want to put it into words, or should've just made the patch in the first place instead of talking about it. :D
    • Apr 23 2015 | 5:47 pm
      amazing Rob!! thanks for work out Andrews clever idea!!
      one question, what exactly does the gen sample operation between the UVs and the noisy matrix? and what happens with z plane?
    • Apr 23 2015 | 6:01 pm
      The 'sample' operator outputs the cell/pixel value from its left input using the coordinates given by the right input. The coordinates are expected to be in normalized x/y values (0-1). In this case the texcoord values are used to get values from the noise matrix and output them. The z-plane should also be getting a noise value as well.
    • Dec 20 2015 | 11:55 pm
      I very often work with points only so what I needed was a kind of "zl thin" for matrix that would remove all the duplicates from a geometry matrix that comes from jit.gl.model. The reason for that is saving big amount of processing power when working with bigger models. So I made a java external that removes all duplicates from geometry matrix. It is very badly programmed but it works!:) Hence it might take quite a lot of minutes for larger models/matrices to process. So it expects 3 plane matrix and it spits out 3 plane matrix. Send in a matrix only once (!) because as I said it might take few minutes for larger matrices.