Vertex Distort Selection

Scratchpole's picture

Hi all, I downloaded a comp the other day, I think Dust made it. It is named vetrex_distort_selection.qtz. Cannot find it on here now and I am having a little trouble understanding how the openCL kernel works.

With a simple three cube model I created yesterday I set the input z position to -0.5, 0 and 0.5 respectively to move the three layers of vertex to the desired positions. Today I have subdivided the model so I can do some more interesting warps and animations. Now I cannot ascertain how the z position relates to the model.

Any one got any tips or know of any issues with this kernel?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: Vertex Distort Selection

here is the file again with the vertices numbered for debugging. that might help you understand whats going on with your model. i have an interesting version laying around somewhere that @offnoll had made work buy nudging with the arrow keys instead of using the mouse. he also had his cube model with back faces to make less vertex. this file http://kineme.net/composition/dust/sculptygesturewip is almost the same.... it may help you with using the z depth to select vertices at an unknown z depth ? i have yet to get into three-d projection mapping. so far i have made a 2D interactive floor projection but nothing 3D so someone else would know more about how all that is done.

PreviewAttachmentSize
warp points 2.zip132.37 KB

Scratchpole's picture
Re: Vertex Distort Selection

Thanks Dustin. I'll digest this comp tomorrow and I recon' I'll be back with more questions... Where did this CLKernel come from? Did you write it?

dust's picture
Re: Vertex Distort Selection

the cl kernel comes from the stock mesh buldge filter, I then modified it. so no I didn't write it. the actual buldge filter macro is more complex. I slimmed the macro down and modified it so you could move vertex points with the mouse instead of buldge them outward or inward.

Scratchpole's picture
Re: Vertex Distort Selection

Right then here's the questions...

What does the inputPos W relate to?

When you move verts close to or over others they unite with others on the same z plane. I guess that's a hangover from the bulge filter. Can that be fixed so they never unite?

Is input Radius relating to how close you have to be to select a vert? Does that affect the above?

I have found that mouse position does not correlate exactly to selecting a preferred vetex. As a solve I use the Ortho environment, then mouse position is accurate.

Cheers

dust's picture
Re: Vertex Distort Selection

yes the radius is how close you have to be to a vert... this patch was never really ment to be for a 3D model. the tricky part is that with a 3D polygon mesh you need to be grabbing 3 points at a time because of the way the triangulation works. so you really kind of need that distance and radius function to grab three at a time. one corner of a box would have 3 vertex points in the same location. one could move one point at a time but its less messy to grab three. the more complex the model the more complicated it gets to know whats going on. franz has a 1024_structure interaction example that works similarly, where you can grab points in a structure and move them around based on a threshold, you can even nudge points. the issue with 1024 interactions is still the same where as you would be grabbing one point at a time. now it may be possible to sort this all out with some proper indicies. like using the indicies to know the indexing order into the triangular structure could work instead of using a distance radius. i have had problems getting the proper indicies out of the mesh importer so something really custom would have to be made.

Scratchpole's picture
Re: Vertex Distort Selection

Cheers Dust, I had not looked at _1024 structure tools even though I had seen it upon released. Thankyou Franz. In combination with your numbered structure interation composition it all makes sense. It works a treat!

So now I can load up a dae mesh, convert it to an xyz structure and then interact with it's numbered vertex. 3D mapping made easy :) I expect saving out the structure will be a bit quicker than going through the dae>xyz conversion process, every time I start the composition it takes quite a few seconds to get going.

So now the challenge continues: Image structures vs UV mapping? Animating the structure...etc etc

P.S. I would still like to know what the InputPos W means in that bulge CL Kernel...???

gtoledo3's picture
Re: Vertex Distort Selection

The w lane of a vertex structure like this will usually control the scale. If you had a structure drawing to points or mesh, and bumped the w lane up to 2, it would appear twice as big. An input W likely effectively increases radius. It should basically be set to 1 and ignored.

This is a similar kind of composition: http://kineme.net/composition/gtoledo3/OpenCLSculpt

dust's picture
Re: Vertex Distort Selection

think of w as a perspective or a scale like george is saying. in order to make the math work when doing a affine transformations a fourth dimension is needed in order to multiply the matrix by the vector. i have not formally been taught linear algebra so my explanation is a bit weak but hear it goes... homogenous coordinates xyz are multiplied by w, so to get back your original coordinates you need to divide or well you don't this it all happens behind the scenes. also and not confuse you here but there is some grey area behind the scenes as well. in reality there is there is actually some w/z term in the projection matrix where as at some point during a vector to matrix multiplication w is not equal to 1, which like george mentioned scales more distant things smaller to create the illusion of depth. this is called a homogenous or perspective divide.

in other words when w is set to 1 for points xyz then multiplication and division give you back the same xyz, which ensures that when you multiply a vector with another matrix that only the xyz values that you need are effected. basically it lets you pack your homogenous coordinates into a vector and perform multiplication and addition etc... in order to lets say rotate a vector around a certain axis. if thinking in 2D xy you can visualize the z depth as being your w and to rotate your vector about the z axis your last row in the matrix is 0 0 1 so when dealing with xyz you need to add a 4th row to the matrix to make every thing work. here this wiki might help... http://en.wikipedia.org/wiki/Transformation_matrix look at affine transformations and perspective projection section and it might help you visualize.