DisplaceX
Function
This is a general purpose warping tool, similar to WarpX, except
you can access a second warping image to control the distribution of a
warp. You can put any formula you want into the x and y fields to do custom
warps. You can also create multi-line expressions in this function. See
the second script tutorial for an extended example of the DisplaceX
function.
Parameters
|
Type
|
Defaults
|
Function
|
oversampling |
int
|
1 |
The actual number of samples
per pixel equals this number squared. For better antialiasing, increase
the number. |
x,yExpression |
float
|
x, y |
The expression for where the pixel information is pulled from.
Expressions of x and y return the same image. Expressions of x+5,
y+5 will pull the color from the pixel 5 units up and to the right
of the current pixel. You can access the values of the warping image
(the second one) with r,g,b,a, and z.
Example expressions:
"x*r"
"x+((r-.5)*30*r)"
"x+cos(y/140)*70*g"
"x+r*r*cos(x*y/100)*100"
|
x,yDelta |
float
|
0, xDelta |
They set the maximum distance
that any pixel is expected to move, but doesn't actually move
it. From any given pixel, it may be affected by any pixel within
the Delta distance. This means it has to consider a much greater amount
of pixels that possibly may effect the currently rendered pixel.
This is bad. However, if you set a Delta value to too small an amount,
you will get errors if your expression tells the pixel to move beyond
that limit. Therefore, it always takes some testing to balance between
speed with errors, or accuracy with drastically slower renders. Our
advice: start small and increase the size until the errors disappear. |
Synopsis
image DisplaceX(
image,
image,
int oversampling,
float expression xExpression,
float expression yExpression,
int xDelta,
int yDelta
);
Script
image = DisplaceX(
image,
image,
oversampling,
xExpression,
yExpression,
xDelta,
yDelta
);
For multi-line expressions:
image = DisplaceX(
image,
image,
oversampling,
{{ xExpr1, xExpr2, ... xExprN }},
yExpression,
xDelta,
yDelta
);
Command Line
shake -displacex oversampling xExpression etc...
See Also
Randomize, Rand,
Turbulate
|