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 autodesk. Show all posts
Showing posts with label autodesk. Show all posts
Sunday, 2 April 2017
Monday, 2 January 2017
Pose Reader / Custom Locator
I had a bit of spare time over the holidays so I set myself a side project to work on when I got a spare moment.
I decided to try my luck with a custom locator as I've never built one before but I wanted to make it useful in some way so I went for a pose-reader! Yea..very original I know. But it's always a staple in any riggers toolkit (whether as a plugin or just straight out the box Maya nodes).
This video by Marco Giordano helped me get my maths straight on the subject and I had to read up a bit about spherical co-ordinates to build the cone points at the correct place given some angle.
Unfortunately it's legacy viewport only. The scripted examples (Python API) for custom locators in the devkit seem to be..well...a bit of a mess. So I skipped VP 2.0 support. I'm lazy.
I decided to try my luck with a custom locator as I've never built one before but I wanted to make it useful in some way so I went for a pose-reader! Yea..very original I know. But it's always a staple in any riggers toolkit (whether as a plugin or just straight out the box Maya nodes).
This video by Marco Giordano helped me get my maths straight on the subject and I had to read up a bit about spherical co-ordinates to build the cone points at the correct place given some angle.
Unfortunately it's legacy viewport only. The scripted examples (Python API) for custom locators in the devkit seem to be..well...a bit of a mess. So I skipped VP 2.0 support. I'm lazy.
Labels:
api,
autodesk,
mpxlocatornode,
pose reader,
python api,
rigging,
vectors
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.
Tuesday, 7 June 2016
Deformers!
I've been diving into the world of deformers this week and it's opening up a whole new world of pain. Especially if you want to do something more substantial than make a ripple effect...which by the way, is one of the few things you can feast your eyes upon in the demo below. It's not as if you can do the same with a standard non-linear deformer in Maya*..
I'm going to try and work on a more functional collision deformer soon, but I think the next few posts will be devoted to demonstrating some basic things you can do with the Maya Python API. All I need to do is think up some good examples! :)
* ..hey..it's all about learning!
Sunday, 29 May 2016
Surface Constraint
Following on from last week, I've been looking at how to build something similar to the geometry constraint in Maya.
It's certainly a tricky one. I've just found out about tangents and binormals which I'm still struggling to grasp but they are useful for building a somewhat stable surface based matrix..i think.
I'd like to do a bit of a write up on it soon, there's so many things I'm not too sure about.
For one thing, using MFnMesh.getClosestPointAndNormal() won't return a normal in world space if I'm getting the mesh data using inputValue.asMeshTransformed(). Is this a bug? Maybe I'm using it wrong.
Here's a quick demo.
Wednesday, 25 May 2016
Vertex Constraint aka Rivet
Just a quick update this week. I learnt some cool stuff to do with building matrixes...or matrices. Yea..matrices.
As far as I can tell thus far in my investigations, you need the following basic ingredients to start with:
1) A unit vector
2) The normalized cross product of 1) and any vector that isn't a scalar of 1) *
3) The cross product of the vector from 1) and 2). Again, needs to be normalized
4) A point
I picked up a good maths intro series from Chad Vernon to which he alluded how to build something that resembles the classic rivet constraint. It was an interesting challenge to take on as I only had some clues to go by, not a step by step guide. I'm glad I stuck with it and got something working in the end.
I've tested it on a skinned mesh with blendshapes and its doing the job so far. Yea..I can't believe it either.
Thanks http://www.hippydrome.com/ for the free model.
* I wonder what happens when you take the cross product of a and -a...
As far as I can tell thus far in my investigations, you need the following basic ingredients to start with:
1) A unit vector
2) The normalized cross product of 1) and any vector that isn't a scalar of 1) *
3) The cross product of the vector from 1) and 2). Again, needs to be normalized
4) A point
I picked up a good maths intro series from Chad Vernon to which he alluded how to build something that resembles the classic rivet constraint. It was an interesting challenge to take on as I only had some clues to go by, not a step by step guide. I'm glad I stuck with it and got something working in the end.
I've tested it on a skinned mesh with blendshapes and its doing the job so far. Yea..I can't believe it either.
Thanks http://www.hippydrome.com/ for the free model.
* I wonder what happens when you take the cross product of a and -a...
Subscribe to:
Posts (Atom)