In this tutorial you will learn how to create a Node Graph project that scales an image in multiple steps, composing each step on top of the previous one to create a tunnel like effect.
Create a new empty project. File > New > Empty Project
Add an image . Drag drop the new image, or and drag and drop new reader icon.
Add a transform node. .
In Transform node expose as input the Scale attribute. Right click the Transform node and check the Scale attribute.
Create a new Attributes node. . Rename it as Scale, set the type number between 0.0 and 1.0 with 2 decimals. Set the scale to 0.9. This will be the default value of the attribute when this project is loaded in by a Node Graph node.
Add a Math > Point node. . Expose attributes x and y.
Connect Attributes> scale to x>Point and y > Point.
The Attributes node defines 3 attributes: The size of the borders and the colors of the two borders.
The Gradient node.
The Image IO inside the Inputs Node Frame defines the input of the reusable node.
The Image IO inside the Outputs Node Frame defines the output of the reusable node.
The nodes inside the Body of the Algorithm Node Frame define the body of the custom node: The Border nodes. Their exposed attributes are fed by the Attributes Node. Left Click on node to expose its attributes.
This project is saved in a file Double_Border.pxf.
This Double_Border node applies the two borders to the image with the border size and colors defined in the attributes of the Node Graph node.
You will now modify the Double_Border.pxf project to add more borders to the image using multiple loops. Each border will be one size larger than the previous border.
In a new project create a new Reader node with an image and a new Node Graph node. Load the DoubleBorderLoop.pxf project in this node.
Increase the number of iterations in the DoubleBorderLoop node.
There is something wrong. The DoubleBorderLoop node is not applying multiple borders, instead it is creating a larger border.
This happens because by default the Node Graph node applies the same node graph to the same input image, and each iteration makes the border larger.
To fix the effect you need to tell the Node Graph node that the new border has to be applied to image generated in the previous loop.
Load the DoubleBorderLoop.pxf project.
In a new project create a new Reader node with an image and a new Node Graph node. Load the DoubleBorderLoop.pxf project in this node.
Increase the number of iterations in the DoubleBorderLoop node.
Now that you have a node graph project that can be reused, you can create a new node type