WarpX

Function

This is a general purpose warping tool, similar to ColorX, except instead of changing a pixel's color, you change its position. 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.

One note of caution: WarpX doesn't properly set the DOD, so you may be obliged to manually attach a Transform- SetDOD node after WarpX.

Here are some examples, all on a grid. By modifying x and y, you are saying from what pixel the information is pulled from, i.e., x+5, y+5 will shift the image left and down by 5 pixels.

x
y

x+3*sin(y/10)
y+3*sin(x/10)
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float newr=r*sin(r/100); width/2+ newr*xc/r
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float newr=r*sin(r/100); height/2+ newr*yc/r
((x/width-0.5)*sin(3.141592654*y/height)+0.5)*width
y
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float a=atan2(yc,xc); float newA= a+3.141592654/2*r/200; width/2+r*cos(newA)
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float a=atan2(yc,xc); float newA= a+3.141592654/2*r/200; height/2+r*sin(newA)
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float newr=r+3*sin(r/2); width/2+ newr*xc/r
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float newr=r+3*sin(r/2); height/2+ newr*yc/r
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float a=atan2d(yc,xc); float newA= a+((int)a)%8-4; width/2+r*cosd(newA)
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float a=atan2d(yc,xc); float newA= a+((int)a)%8-4; width/2+r*sind(newA)
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float newr=r*r/200; width/2+ newr*xc/r
float xc=(x-width/2); float yc=(y-height/2); float r=sqrt(xc*xc+yc*yc); float newr=r*r/200;; height/2+ newr*yc/r

 

Synopsis

image WarpX( image,
  int oversampling, 
  float expression xExpression,
  float expression yExpression,
  int xDelta,
  int yDelta
);

Script

image = WarpX(
  image, 
  oversampling, 
  xExpression,
  yExpression,
  xDelta,
  yDelta
);

For multi-line expressions:
image = WarpX( 
  image,
  oversampling, 
  {{ xExpr1, xExpr2, ... xExprN }},
  yExpression,
  xDelta,
  yDelta
);

Command Line

shake -warpx oversampling xExpression etc...
Parameters
Type
Function
oversampling
int
The actual number of samples per pixel equals this number squared. For better antialiasing, increase the number.
x,yExpression
float

The expression to be placed. See above for examples.

x,yDelta
float
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 with 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.

 

See Also
Randomize, Rand, Turbulate