|
|
|||||
![]() |
|||||||||
| |
|||||||||
![]() |
![]() |
| Attention Visitor: |
| You may have to register before you can post or view attachments! Registered users also only see 1/2 the adds that regular users see, so if you are registered, make sure you log in! |
|
|||||||
| Register | FAQ | Members | VFXwiki | Downloads | Portfolios | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
ViewsEyeon:Manual/Tool Reference/Misc/Custom ToolFrom VFXWiki
[edit] Custom Controls TabPoint In 1-4, X And Y
These four controls are 2D X and Y center controls that are available to expressions entered in the Setup, Intermediate and Channels tabs as variables p1x, p1y, ...., p4x, p4y. They are normal positional controls and can be animated or connected to modifiers as any other tool might. Number In 1-8
The values of these controls are available to expressions entered in the Setup, Intermediate and Channels tabs as variables n1, n2, n3, ..., n8. They are normal slider controls, and can be animated or connected to modifiers exactly as any other tool might. These controls can be renamed using the options in the config tab to make their meanings more apparent, but expressions will still see the values as n1, n2, ..., n8.
[edit] Custom Setup TabSetup 1-4
Up to four separate expressions can be calculated in the Setup tab of the Custom tool. The Setup expressions are evaluated once per frame, before any other calculations are performed. The results are then made available to the other expressions in the Custom tool as variables s1, s2, s3 and s4.
[edit] Custom Inter TabIntermediate 1-4
An additional four expressions can be calculated in the Inter tab. The Inter expressions are evaluated once per pixel, after the Setup expressions are evaluated but before the Channel expressions are evaluated. Results are available as variables i1, i2, i3 and i4.
[edit] Custom Config TabInput Variables
Color Channel expressions (RGBA) should return Floating Point values between 0.0 and 1.0, and all other expression values must produce values between -1.0 and 1.0. The Channel expressions may use the results from both the Setup expressions (as variables s1-s4) and Inter expressions (as variables i1-i4).
[edit] Channels TabRGBA, Z, UV Expressions And XYZ Normal Expressions
The Channel tab is used to set up one expression per each available channel of the image. Each expression is evaluated once per pixel, and the result is used to create the value for that pixel in the output of the image.
[edit] Custom Tool Syntax
[edit] ExamplesThe following example is intended to help you understand the various components of the Custom tool. Our example duplicates the functionality of a 3x3 Custom Filter tool set to averages the current pixel together with the eight pixels surrounding it. To duplicate it with a Custom tool, add a Custom tool to the Flow, and enter the following expressions into the Setup tab. (Leave the tool disconnected to prevent it from updating until we are ready.)
These two expressions will be evaluated at the beginning of each frame. S1 divides 1.0 by the current width of the frame, and S2 divides 1.0 by the height. This provides a Floating Point value between 0.0 and 1.0 that represents the distance from the current pixel to the next pixel along each axis. Now enter the following expression into the first text control of the Channel tab (r) (getr1w(x-s1, y-s2) + getr1w(x, y-s2) + getr1w(x+s1, y-s2) + getr1w(x+s1, y) + getr1w(x-s1, y) + r1 + getr1w(x-s1, y+s2) + getr1w(x, y+s2) + getr1w(x+s1, y+s2)) / 9 This expression adds the nine pixels above the current pixel together by calling the getr1w() function nine times and providing it with values relative to the current position. Note that we referred to the pixels by using x+s1, y+s2 rather than using x+1, y+1. Fusion refers to pixels as Floating Point values between 0.0 and 1.0, which is why we created the expressions we used in the Setup tab. If we had used x+1, y+1 instead, the expression would have sampled the exact same pixel over and over again. (The function we used wraps the pixel position around the image if the offset values are out of range.) That took care of the red channel, now use the following expressions for the green, blue and alpha channels. (getg1w(x-s1, y-s2) + getg1w(x, y-s2) + getg1w(x+s1, y-s2) + getg1w(x+s1, y) + getg1w(x-s1, y) + g1 + getg1w(x-s1, y+s2) + getg1w(x, y+s2) + getg1w(x+s1, y+s2)) / 9
(getb1w(x-s1, y-s2) + getb1w(x, y-s2) + getb1w(x+s1, y-s2) + getb1w(x+s1, y) + getb1w(x-s1, y) + b1 + getb1w(x-s1, y+s2) + getb1w(x, y+s2) + getb1w(x+s1, y+s2)) / 9 (geta1w(x-s1, y-s2) + geta1w(x, y-s2) + geta1w(x+s1, y-s2) + geta1w(x+s1, y) + geta1w(x-s1, y) + a1 + geta1w(x-s1, y+s2) + geta1w(x, y+s2) + geta1w(x+s1, y+s2)) / 9 It is time to view the results. Add a Background tool set to solid color and change the color to a pure red. Add a hard edged rectangular Effects Mask and connect it to the expression just created. For comparison, add a Custom Filter tool and duplicate the settings from the image above. Connect a pipe to this tool from the background to the tool and view the results. Alternate between viewing the Custom tool and the Custom Filter while zoomed in close to the top corners of the Effects Mask. Of course, the Custom Filter tool renders a lot faster than the Custom tool we created, but the flexibility of the Custom tool is its primary advantage. For example, you could use an image connected to input 2 to control the median applied to input one by changing all instances of getr1w, getg1w, and getb1w in the expression to getr2w, getg2w, and getb2w, but leaving the r1, g1, and b1's as they are. This is just one example, the possibilities of the Custom tool are limitless.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |