I'd like to use Maya's *implicit* objects as locators to control the influence of deformers and fields:
- implicitSphere
- implicitCube
- implicitCone
These objects have size attributes (e.g. radius, cone angle) and transformation attributes (a transform node).
Unfortunately, I can't just import them into the Bifrost Graph.
How can I use these objects in Bifrost?
How do I calculate e.g. how close a point is to an implicitSphere's center considering the sphere's transformation?
Solved! Go to Solution.
Solved by Grahame_Fuller. Go to Solution.
Isnt the extrude compound using an influence objet?
https://area.autodesk.com/downloads/extrude/#
No, it is just a location and a dropoff value.
I could wire a locator's position and maybe a scaling value.
But for example the implicitCone has a specific shape (same with non uniform scale on all objects).
Even for the moved/rotated/scaled sphere I don't know how to calculate if a point is inside.
Hi Roland,
Right now, there is no built-in way to test whether points are inside something like an implicit sphere. However, it's a fairly straightforward computation in the graph if you know the sphere's radius and world transform. (If you do this computation a lot, it would be helpful to publish a reusable compound for it.)
To get inputs like the radius and world transform into the graph, you'll need to connect them individually:
I hope that helps,
gray
Hi Roland,
The easiest way is probably to convert the point positions that you are testing into the local coordinates of the sphere, and check their lengths against the radius.
I hope that helps,
gray
Don't I first have to set the translation for the sphere matrix to zero?
You shouldn't need to set the translation of the matrix to zero, assuming that you want to move the sphere and find the points inside it based on its current position, wherever that may be.
Maybe I'm misunderstanding what you are trying to do?
gray
I thought that when I apply the inverse matrix WITH the translation i would move the point around.
All I want to do is rotate and scale the points position, before I measure its distance to the sphere center, right?
On the other hand... when I apply the inverse matrix WITH the translation then I just measure the points distance to (0,0,0). Is that correct?
I can only test it tomorrow (I’m in Germany).
What I posted above doesn't actually move anything (unless you use set_point_position with those values). The idea is to convert the point positions from world coordinates so that they are expressed relative to the sphere instead. This is so that you can compare their lengths to the sphere's radius and know whether they are inside or not.
If you move the sphere so that it now encloses different points, you need to take that translation into account when converting the points' coordinates. This is why you need to not zero out the sphere's translation.
But note that this is just for determining whether the points are inside the sphere and should be deformed or not. What happens next depends on how you want to deform those points.
For example, if you want to add an offset to their current positions, you'd start with the original, unconverted, world-space positions of those points. On the other hand, if you want to scale them about the sphere's center, you'd multiply the converted positions by some factor and then convert them back to world space before you set their new values on the geometry. (Converting back to world-space involves turning them back to 4D with w = 1 again, multiplying them matrix-first with the uninverted matrix, and finally turning them back to 3D.)
Good luck!
gray
Ok, it workes! 😀
In this example I shrink the surface of the torus along the point normals, but only inside the implicit sphere.
The sphere can be moved, rotated, scaled.
This is the compound that checks if points are inside the sphere.
It outputs an array of factors for each point on the torus geometry and I can multiply any modification (grow, shrink, noise, etc.) with the factor (see the final graph).
How do I find out if a point is inside the moved/rotated/scaled sphere?
I followed @Grahame_Fuller's advice to transform the points with the Inverse Matrix of the sphere and then just measure the distance to the center (= length of the position vector).
The position inside the sphere is then divided by the radius and the result (clamped and fcurved) is the array of factors.
The final graph for this grow/shrink modification looks like this.
Note that the implicit sphere (createNode implicitSphere) cannot be dragged into the Bifrost Graph directly. You have to create the plugs on the input node and then in the Node Editor connect the sphere's worldMatrix and Radius.
Piece of cake, right?
Oh, before I forget it:
Here's a MEL script that
IMPORTANT: the node "bifrostGraph#" needs to be selected in the Outliner when you execute this.
Put this on your shelf.
Makes your life easier when you test this stuff 🙂
$bifrostBoards = `ls -sl -type "bifrostBoard"`;
if (size($bifrostBoards)) {
$sphereName = `createNode implicitSphere`;
$name = `vnnCompound $bifrostBoards[0] "/" -addIONode true`;
vnnCompound $bifrostBoards[0] "/" -renameNode $name $sphereName;
vnnNode $bifrostBoards[0] ("/" + $sphereName) -createOutputPort ($sphereName + "Matrix") "Math::float4x4";
vnnNode $bifrostBoards[0] ("/" + $sphereName) -createOutputPort ($sphereName + "Radius") "float";
connectAttr ($sphereName + ".worldMatrix[0]") ($bifrostBoards[0] + ("." + $sphereName + "Matrix"));
connectAttr ($sphereName + ".radius") ($bifrostBoards[0] + ("." + $sphereName + "Radius"));
$name = `vnnCompound $bifrostBoards[0] "/" -addNode "BifrostGraph,User::Compounds,influenceSphere_pointFactor"`;
vnnConnect $bifrostBoards[0] ("." + $sphereName + "Matrix") ("/" + $name[0] + ".matrix");
vnnConnect $bifrostBoards[0] ("." + $sphereName + "Radius") ("/" + $name[0] + ".radius");
} else warning "No bifrostBoard node selected (e.g. \"bifrostGraph1\")";
I'm glad it helped. I like that illustration — it really helps to show how it works.
gray
Can't find what you're looking for? Ask the community or share your knowledge.