Forums > Jitter

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



dtr
May 31, 2014 | 3: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

– Pasted Max Patch, click to expand. –
June 1, 2014 | 4: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


dtr
June 2, 2014 | 3: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.

June 2, 2014 | 7:25 am

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.

Attachments:
  1. Screen-Shot-2014-06-02-at-16.21.41
  2. Screen-Shot-2014-06-02-at-16.22.43
June 2, 2014 | 10:44 am

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 ?

June 2, 2014 | 10:46 am

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.

November 17, 2014 | 10:16 am

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.


dtr
November 18, 2014 | 12: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.

  • This reply was modified 5 months by  dtr.
April 22, 2015 | 5:03 am

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…

thanks!

April 22, 2015 | 10:10 am

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.

April 22, 2015 | 10:39 am

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..

Attachments:
  1. Captura-de-pantalla-2015-04-22-a-las-19.36.43
April 22, 2015 | 1: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 :(

April 22, 2015 | 4: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.

April 22, 2015 | 6:34 pm

I know some of those words.


dtr
April 23, 2015 | 1:03 am

lol


dtr
April 23, 2015 | 1: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?

April 23, 2015 | 5:49 am

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 <<<<<<<<<<<<<<, small meshes are joined if possible, and Nodes with no data assigned are collapsed and joined.

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?

thanks!


dtr
April 23, 2015 | 6:59 am

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.

April 23, 2015 | 8:55 am

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:

– Pasted Max Patch, click to expand. –
April 23, 2015 | 10:31 am

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

April 23, 2015 | 10:47 am

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?

!THANKS!

April 23, 2015 | 11:01 am

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.

Viewing 22 posts - 1 through 22 (of 22 total)

Forums > Jitter