WarpX

 

Function

The WarpX function is a general purpose warping tool, similar to ColorX, except instead of changing a pixel’s color, you change its position. Any formula can be entered in the x and y fields for custom warps. You can also create multiline expressions in this function.

One note of caution: WarpX does not properly set the DOD, so you may need to manually attach a TransformSetDOD node following the WarpX node.

The following examples are on a grid. By modifying x and y, you specify from what pixel the information is pulled. For example, x+5, y+5 shifts 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