Blocks Rock!

July 20, 2016

Canvas Unleashed

Blocks change everything you thought you knew about Fabric and Canvas. Blocks take Canvas visual programming from “this is cool, but I wish I didn’t have to resort to writing code for some things” to “this is freaking awesome, now I can do it all graphically.”

The goal for Canvas is to make visual programming fun and intuitive, and Blocks delivers on that in spades by providing an elegant mechanism for handling things that used to require coding. Explaining Blocks in writing just doesn’t do them justice, so we encourage you to take a few moments to see them applied by watching the What’s New in Fabric 2.3 video.

Blocks are graph containers for user-provided functionality within a preset. With blocks, technical directors can create complex presets (either graphically or with code) and encapsulate them by exposing the parts that make sense for non-technical users to modify with blocks, filling in the content of these blocks without knowing the details of the preset.

If you’re not particularly technical, simply put, Blocks make it straightforward for you to control the behavior of presets supplied by Fabric or the technical staff at your studio, making it even easier to do many common tasks in Canvas.

Calculations on a per-object or vertex basis can now be done with a simple, graphical interface instead of requiring a TD or programmer to write KL code – the “block” inside a “for” loop is literally a Canvas graph. You no longer need to think about how to manage arrays and data structures. Instead, you focus on what needs to happen on that object or vertex. It’s very clean and very visual. Consider deformations. Blocks allow you to think about a single vertex at a time. “I want each vertex to be pushed along its normal by an amount based on the value of the texture map at that vertex” is easy to define within a block.

Unlimited Possibilities

If you’re a technical artist, a TD or a programmer, Blocks are powerful and flexible – there are no context limitations and the combinations are endless.

 

Blocks_creation-in-graph

 

This opens up an entire new realm of possibilities from generating procedural geometry, deformations, image manipulation to simulation. In general, anything that requires array traversal and computation.  For example, you can tweak the velocity/density of a fluid solver’s result then use that result to advect particles in another block preset.

 

Blocks_FluidSolver

 

Or you can generate the Mandelbrot set without a single line of KL code:

 

Blocks_Mandelbrot

 

Fabric ships with a number of very useful pre-defined Blocks, such as:

 

ForLoop Traditional For Loop
Array AccumulateWhile A While which accumulates the value of each iteration and has an exit condition
Array Filter Filters an array based on a condition defined in the block
Geometry Deform Iterates through the positions of a Geometry primitive and exposes a block to modify them
Image Modify Iterates through the pixels of an Image and exposes a block to modify them

 

Simplify Complexity

The real fun begins when you start defining your own.  Blocks allow you to create and switch between different computation contexts. A computation context basically means ‘do this kind of work on this kind of data’ – for example, a context could be ‘do this simulation per particle’ or ‘do this deformation per muscle’. In other visual programming systems, the computation contexts that you can work with are pre-defined e.g. per particle. This is great when you’re working within those boundaries, but becomes overly complicated once you try and work outside of them – if the computation context doesn’t already exist then you need to either write it yourself in code or shoehorn functionality into what you have available. With Canvas Blocks you can work with our predefined contexts or just create your own custom contexts with nodes. A good example is a feather system – you could create a context for the barbs on each feather (handling things like density, distribution, randomization) and then create a context that handles lots of those feathers at once (groom, variance, angle). You might also have another context that handles the interaction of feathers upon each other. Then have all of this bundled into various Blocks that only expose the key parts to your artists. This allows them to extend and modify the feather Blocks without being concerned with the underlying contexts.

By introducing Blocks we haven’t given up on KL.  In fact, Blocks can be exposed from KL nodes, which allows you to seamlessly move back and forth between visual and KL programming. The cool part being that you can build presets in KL that expose Blocks to users, and then your users don’t need to know any KL to make the presets drive custom code. Or as one of our staff put it: “The greatest thing about Fabric / Canvas / Blocks is that I (the not so computer sciencey guy of the group) can write custom nodes without having to know C++; I just couldn’t do that in ICE.”

The ability to define what Blocks operate on is a huge benefit.  In Softimage ICE, for example, implementing a feather system is possible, but convoluted and complex: more complex data structures such as two-dimensional arrays need to be introduced to get past the fundamental per-vertex or per-polygon design. In Canvas, Blocks allow users to encapsulate operations on sets of arrays and display those operations logically to users to easily visualize staged operations on data.

 

Blocks_FluidSolver

 

Usability is also improved because systems built by TDs using Blocks can expose only the necessary controls to artists; in essence, Blocks act as a “friendly fence”: only the controls artists need are exposed while the complex logic and calculations are fenced off, preventing things that shouldn’t be messed with from getting inadvertently messed up.

Creating custom deformations on rigs, post-deformation effects, and even simulated geometry deformation (Muscle and Skin systems) are now possible without writing a single line of code. Re-using deformations within other deformations is now possible too with the ability to embed blocks within blocks.

Getting Started With Blocks

Blocks have been added to Fabric Engine 2.3. If you’re an existing user, just download the latest version.  If you’re new to Fabric, then Get Fabric. Individual evaluation licenses are free and Fabric 50 licenses are free for the first year. Check out the Blocks section of the Canvas User Guide and the Blocks section of the Canvas Programmer Guide. There are also quite a few presets and samples that ship with Fabric Engine.

We’re very excited about this addition to Canvas visual programming and we encourage you to share interesting .canvas graphs with your fellow Fabricians in our forums.

Looking forward to all the cool things you’ll do with Blocks!

 

Team Fabric