Bifrost Quick Compounds – Episode 1: Shape Deformer

Bifrost Quick Compounds – Episode 1: Shape Deformer


Hey everyone, Matt here with the Maya Learning Channel. So I’m back from Siggraph 2019, where we just announced the new Bifrost for the first time. Since then, I’ve posted some Getting Started material as well as some in-depth Masterclasses to the channel, which I fully recommend taking a look at if you haven’t already. We’ve also activated the Bifrost AREA forum: your one stop shop to ask questions, share compounds, and even talk to the actual Bifrost developers! That said, I know that Bifrost requires a bit of a different mindset from the way you’d ordinarily use Maya. So I’m going to focus my next few videos on some easy little compounds that highlight a range of cool things Bifrost can do – but more importantly, that get you into that free-thinking mindset of “anything is possible” that makes working in Bifrost so liberating and fun. Note that all these compounds will be available for free on the AREA forum, so you can use or modify them to your heart’s content. Today I’m going to start with a little modeling, by using Bifrost to build a deformer from scratch. As a test shape, I’ll use a polygon plane, scaled up, with a healthy number of subdivisions. Then I’ll create a new Bifrost Graph. Now, when it comes to doing modeling-type things in Bifrost, the easiest approach is to A.) read in all of the object’s vertices as an indexed array, B.) create a second array containing offsets for each of those points, C.) adding those offsets to the original vertices so they end up in new spots. So starting with step A, I’m going to create a “get_point_position” node and feed my polyPlane into it. This will extract all the point positions and put them into an array. Now to make sure it’s working, I’m going to add the same value to each point. So I’ll start with an Add node and pipe my points into it… And then create a Value node. I’ll need to set the value “Type” up here, which will be a Vector of Float3. This gives me the 3 fields I need to specify X, Y, and Z coordinates. In this case, let’s start with a value of 0, 10, 0. And then I’ll just hook this into the Add node. Finally, I’ll use set_point_position to set the original plane’s points to these new combined values. And then just output the result. As you can see, Bifrost outputs my plane, except with every single point offset by 10 units in Y. Of course, now I can play with the Value node to change that offset. Just for posterity, I’m going to add backdrops to these nodes to make each stage of the process obvious. There, now as a proof of concept this is a good start, but obviously we’ll want to get fancier. So instead of adding the same amount evenly to every point, let’s add values to points based on how close they are to some kind of target. I’ll start with another Value node of Float3 and this time name it “value_target”. Now to get the distance from my target to each point on the plane, I’ll need to subtract them to get a set of vectors. …then use a Length node to get the actual distances. Now I’ll feed it into my original Value node to add them to the plane’s points. Well now that’s an interesting result, isn’t it? Although it does make sense if you think about it. Remember, each point is getting its distance from the origin added back to it. So points that were far away on the positive side get pushed even further away, while those on the negative side get pushed closer to the origin. The reason for the skewed shape is because of the way I added the length values back to the original points. Notice that I’m piping the length into this value node as a vector, even though “length” is just a single value. This means that I’m adding the same offset to X, Y, and Z axes, which is a little overkill. Instead, let’s choose just one of them – let’s say Y. This result is much easier to understand. Now it’s obvious that points further from the origin get pushed up higher than those closer to the origin. I can even move around my plane or adjust its vertices and the result updates on the fly. But I can take this even further. Watch what happens if I add an “evaluate_fcurve” to my graph. This node scales incoming values based on the curve you see here. So if I run my lengths through this before they go to to the Value node… …then my result gets scaled according to the curve! Now we’re starting to get into pretty cool territory, because it means I can customize the shape of my deformer on the fly! We’re almost there, but if there’s one thing that’s still lacking it’s that my result still skews when I tilt it. That makes sense after all, since I’m only adding length values to the Y axis. But I really should be adding length values along each individual point’s normal. That’d push the surface out along whatever direction the vertex is facing. So to do that, first I’ll get_point_normal, which grabs vertex normals the same way that get_point_position grabs all their positions. Then I’ll multiply that to the end of my chain. Now the result of this IS a vector, since the whole point of multiplying in the normals was to get the normal’s direction. So I’ll wire it straight to the value plug. And there you have it – a bulge with direction! So if you’ve understood everything up to this point, hopefully you can see where we can take this next. We need to add ways to control the center, height, and radius of the bulge. In fact, if you’re up to the challenge, I recommend pausing the video here and trying to add those yourself. Okay, all done? Let’s go through it together, just as a review. First up, remember that the bulge is relative to the position of this value_target node. Changing values here changes the center of the bulge. To make that easier to control, I’m just going to wire it to the input and rename the port “bulge_center”. This exposes the input on the bifrostGraph node, allowing me to do something like connect a locator to it. Now I can move the center around freely! Next, I’ll want to control the height of the bulge. Which’ll require a multiplier to boost up my fcurve result. Thankfully, I’ve already got one of those from my normal calculation, so I’ll just drag another wire from it to my input, and rename it “bulge_height.” Lastly, I want to control the radius of the bulge. The math for this is a bit trickier. Basically, I need to divide all the point-to-target values by a radius value before finding their length. Once I do that, I can then control the radius just like the height! Now that I have all the controls I want, I’m ready to package this up into a compound called bulge_deformer. At which point I can plug in any mesh I want! Now, although this is as far as I’m going to go today, there’s no reason why you can’t take this further. To give you an example of the potential here, I’m going to import another compound made by my colleague, Aslan Jafari. This compound takes the faces around a point and extracts them, Now watch. All I have to do is copy and paste his compound into my graph and then daisy chain them together. Immediately you can see that this shattering effect is added to my bulge effect. I can even turn on his “Use Influencer” option and add my locator for more control. Or Turbulate to add some randomization. And there you have it: I’ve effectively combined two different Bifrost effects into a new one! Now I can plug in something like a building into it to get a cool, shattering glass effect!

Danny Hutson

7 thoughts on “Bifrost Quick Compounds – Episode 1: Shape Deformer

  1. Maya has some of the worst node editors. Simple things like in Hypershade, I've made a shading network and later on I add lights, stuff, etc in the scene… It freaking pukes on my existing shader network. I really hoped it would have been solved in 2015, 2016, 2017, 2018, 2019, etc.

    I am focusing on Blender at the moment, but this Bifrost graph seems intriguing.

  2. Hi, frist it's awesome, but is that faster than maya buildin defomer(softMod)? And if I want paint the weight what need I do?

  3. This is the 6th UI interface added to Maya, or I missed something. A unification and getting rid of old legacy stuff is much needed. This new Bifrost looks great, and in the right direction for future UI design! Keep Maya evolving! thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *