Docs Visual

ComplexMix

Combines two UV fields as complex numbers: add, subtract, multiply, divide or raise one to the other, optionally weighted by a third input, then samples an image through the result.

◧ Visual

Why use it

ComplexOp warps an image through one complex function. To get the sum of two such warps, their product, or one divided by the other, the arithmetic has to happen on the coordinates themselves, per pixel and as complex numbers, before the image is looked up. Compositing the two warped images does something else, so this takes a shader of its own.

ComplexMix is that step. Feed it the UV outputs of two ComplexOps, choose the operation, and the picture comes out warped by the combination. The combined coordinates also leave as a UV field, so you can keep chaining. The complex arithmetic is taken from Ricky Reusser's Shadertoy implementation, credited in the shader source.

Features

How to use it

  1. Create it from the FNS tab of the OP Create dialog.
  2. Wire the image you want to see warped into in1.
  3. Make the two operands: two ComplexOps with different functions, their second outputs (the UV fields) wired into in2 (Op1) and in3 (Op2). The ComplexOps need no image of their own; with nothing wired in they work on a built-in UV map. Keep them on a float Pixel Format, or the coordinates are quantised.
  4. Choose the Operation. Op1 and Op2 pass one operand through on its own, which is the quickest way to check each warp. Add, Subtract, Multiply and Divide combine them, and the two power entries raise Op1 to Op2 or the other way round.
  5. To favour one operand, switch on Weighting and set Fn Weight: 0 is all Op1, 1 is all Op2. It is one value for the whole image. With Add, animating it morphs one warp into the other.
  6. Move the result with Trans, Rot, Scale and Pivot, in the order Transform Order sets. Switch on Aspect to keep rotation and scale round on a non-square output.
  7. Choose what shows where the coordinates leave the image with Extend: hold the edge, zero, repeat or mirror.
  8. Fade the effect with Blend: 0 is the plain image, 1 the full combination. Animate it to bring the warp in on a cue.

To keep going, take out2, the combined UV field, into another ComplexMix, a ComplexOp with Operand/Map off, or a Remap TOP.

Inputs and outputs

  • in1 (TOP): the image that is sampled through the combined coordinates.
  • in2 (TOP): the first complex operand (Op1), a UV map such as ComplexOp's second output.
  • in3 (TOP): the second complex operand (Op2).
  • out1 (TOP): the combined image.
  • out2 (TOP): the combined UV field, for chaining into another sampler.

Get it

Tick it on the install page and it installs with the rest of your setup and stays up to date.

Download ComplexMix.tox Version 1.0.4, the tool on its own. It works in any project, and this copy never updates itself.

Parameters

Custom

ControlType / defaultWhat it does
OperationOperation menuAdd How the two complex operands (input 2 = Op1, input 3 = Op2, read from their red/green channels) combine: either one alone, or complex add, subtract, multiply, divide or power.
Options: Op1, Op2, Add, Subtract, Multiply, Divide, Power1**2, Power2**1
WeightingWeighting on / offoff Scales Op1 by (1 - Fn Weight) and Op2 by Fn Weight before they combine. Not used by Op1 only / Op2 only.
Fn WeightFnweight number0.5 Balance between the operands when Weighting is on: 0 is all Op1, 1 is all Op2.
AspectAspect on / offoff Applies the transform in aspect-corrected space so rotation and scale stay round on non-square outputs.
Transform OrderXord menuScale Rotate Translate Order in which the transform applies scale, rotate and translate to the combined coordinates.
Options: Scale Rotate Translate, Scale Translate Rotate, Rotate Scale Translate, Rotate Translate Scale, Translate Scale Rotate, Translate Rotate Scale
TransMixtrans number0 Moves the combined coordinates along x and y.
RotRot number0 Rotates the combined coordinates by this many degrees around the pivot.
ScaleMixscale number1 Scales the combined coordinates along x and y; larger values zoom in.
PivotPivot number0 Pivot (x, y): the point that rotation and scale happen around.
ExtendMode menuMirror How input 1 is sampled where the coordinates leave 0..1: Hold the edge pixels, Zero (transparent black), Repeat the image, or Mirror it.
Options: Hold, Zero, Repeat, Mirror
BlendBlend number1 Mix between plain screen coordinates (0, input 1 unchanged) and the combined, transformed coordinates (1).

Common

ControlType / defaultWhat it does
ResolutionResolutionread-only number1280 Width and height of the built-in UV map used when nothing is wired into input 1. Disabled while input 1 is connected; the output then takes its resolution.
Input SmoothnessInputfiltertype menuInterpolate Pixels Filtering used when sampling the inputs.
Options: Nearest Pixel, Interpolate Pixels, Mipmap Pixels
Viewer SmoothnessFiltertype menuInterpolate Pixels Filtering used when the output is displayed at another resolution.
Options: Use Input, Nearest Pixel, Interpolate Pixels, Mipmap Pixels
Pixel FormatFormat menuUse Input Pixel format of the outputs. Keep a float format when the UV output feeds another Complex tool or a Remap, or the coordinates are quantised.
Options: Use Input, 8-bit fixed (RGBA), 16-bit float (RGBA), 32-bit float (RGBA), 10-bit RGB, 2-bit Alpha fixed (RGBA), 16-bit fixed (RGBA), 11-bit float (RGB), Positive Values Only, 8-bit fixed (Mono) and 15 more