I had a look at combining Maya's 2D procedural textures and a custom deformer this week. It turns out you can produce some pretty sweet effects, which I haven't really delved into too much so far since there is a ton of layering and cool things you can do with the procedural textures, including animating them.
I used MFnMesh.anyIntersection to test for collision from rays fired from the points of the deforming mesh, in the direction of the reverse normal of the plane. A colleague pointed me to MDynamicsUtil.evalDynamics2dTexture which gave me the colour information I needed, after using MFnMesh.getUVAtPoint to retrieve the UV values at the collision point returned from MFnMesh.anyIntersection.
All in all, it's pretty damn speedy considering all the calculations it's performing. I added in the blend falloff functionality from the inflate deformer for some additional deformation options.
Showing posts with label deformer. Show all posts
Showing posts with label deformer. Show all posts
Sunday, 2 April 2017
Sunday, 16 October 2016
Stretch / Compress Deformer update
Following on from my last post, I decided to take the compress deformer a bit further.
The idea is to create two input meshes that define the stretch and compress behavior for the source mesh, so when a face is being compressed, it will look up the components of the compress mesh and use that to define where (approximately) it's points should go. Same goes for the stretch.
I ran into an annoying bug with the MFnMesh.getNormals() function. After getting weird results with the deformation, and re-checking the code several times, I decided to turn to google and see if anyone else had the same issue. Lo and behold, apparently .getNormals() returns some normals in the wrong order. One to keep in mind.
If you haven't already seen this awesome plug-in, it does this sort of thing, only much better. Seriously cool stuff. Check it out. :)
Monday, 26 September 2016
Stretch / Compression Deformer
Just a quick one this week. I saw a great video on Vimeo for a sort of stretch / compression deformer and it inspired me to try it out.
I figured it was in some way based on the area of the polygons, so as they get smaller, they push outwards along their normals.
Luckily, MItMeshPolygon has a getArea function for that (although I did compute it using the tri's and a few cross products at first...doh!).
I didn't include any stretch in this, if the area increases past it's default, it'll just do whatever it's doing, but if it gets smaller, it'll take an average of all surrounding faces and bulge, based on the painted deformer weight values.
Thanks to hippydrome.com for the model :)
I figured it was in some way based on the area of the polygons, so as they get smaller, they push outwards along their normals.
Luckily, MItMeshPolygon has a getArea function for that (although I did compute it using the tri's and a few cross products at first...doh!).
I didn't include any stretch in this, if the area increases past it's default, it'll just do whatever it's doing, but if it gets smaller, it'll take an average of all surrounding faces and bulge, based on the painted deformer weight values.
Thanks to hippydrome.com for the model :)
Friday, 16 September 2016
Collision Deformer
yay collision!
It's been a while so I thought I'd update with progress on a collision deformer I've been working on.
I must have made 4 or 5 unsuccessful attempts at this before giving up. I had a time out for a month or so and came back to it with a fresh mind. I think it helped. I finally got there in the end but there's still more that can be added.
Subscribe to:
Posts (Atom)