This tutorial covers image displacement techniques in TouchDesigner, demonstrating how to use the Displace TOP to transform and distort images for creative effects.

Understanding the Displace TOP

The Displace TOP works by distorting a source image (input 0) using a displace image (input 1). When you first add a Displace TOP, you’ll see an error because it requires both inputs to function.

Basic Setup

  1. Add a Circle TOP as your source image (set radius to 0.1 x 0.1)
  2. Add a Constant TOP as your displace image
  3. Set the Constant color to 0.5 x 0.5 (50% gray)
  4. Connect Circle to input 0 and Constant to input 1

The 50% gray color is crucial because it represents no displacement - this matches the Source Midpoint parameter.

Key Parameters

Horizontal and Vertical Source

These parameters control which color channels drive displacement:

  • Horizontal Source: Red channel (default)
  • Vertical Source: Blue channel (default)

Some users prefer using Green for vertical displacement since it’s commonly associated with Y-axis values.

Source Midpoint

Set to 0.5 x 0.5 by default. This specifies the color values that result in no displacement. Any values above or below this midpoint will cause displacement in the corresponding direction.

How Displacement Works

  • Red channel above 0.5: Samples pixels from the right, displacing the image left
  • Red channel below 0.5: Samples pixels from the left, displacing the image right
  • Blue channel above 0.5: Displaces the image downward
  • Blue channel below 0.5: Displaces the image upward

Note: The Green channel has no effect unless you configure it as a displacement source.

Creating a Water Ripple Effect

Setup

  1. Add a Movie File In TOP with your source image
  2. Add a Noise TOP with:
    • Monochrome: Off (to get red and blue channel variation)
    • Resolution: Match your source image (e.g., 1280 x 720)
  3. Connect Movie File In to input 0 and Noise to input 1 of a Displace TOP

Displace Weight

The Displace Weight parameter controls the amount of displacement:

  • Higher values = more dramatic distortion
  • Lower values = subtle effects
  • Try 0.05 x 0.05 for a subtle water-like ripple

Animating the Noise

On the Noise TOP’s Transform page, add an expression to Translate TZ:

absTime.seconds * 0.15

Adjust the multiplier for faster or slower animation.

Noise Period

Increase the Period parameter on the Noise TOP for larger, more organic warps and warbles.

Handling Edge Artifacts

The Extend parameter on the Displace TOP controls how edges are handled:

  • Hold: Stretches edge pixels (can cause visible artifacts)
  • Zero: No pixels at edges (creates a flag-blowing effect)
  • Mirror: Mirrors pixel values for cleaner edges (recommended)

Vignette Displacement Effect

To apply displacement only to the edges of an image (like a camera lens distortion):

  1. After your Noise TOP, insert a Circle TOP
  2. Set the Circle’s Fill Color to 0.5 x 0.5 (matching the Source Midpoint)
  3. Increase Softness to around 0.15 for a gradual transition
  4. Reduce Noise Amplitude to 0.2 for a more subtle effect

This creates displacement only at the edges while keeping the center undistorted.

Channel Mask

On the Common page, the Channel Mask parameter lets you selectively apply displacement to specific channels:

  • Toggle off Red to create chromatic aberration effects
  • The displacement will affect Green, Blue, and Alpha while leaving Red unchanged

UV Weight for Chromatic Aberration

The UV Weight parameter creates additional distortion effects:

  • Values close to 1.0: Normal behavior
  • Values approaching 0: Zooms into the displacement
  • Try 0.95 for a subtle chromatic aberration effect

Practical Tips

  • Use middle mouse button for precise parameter adjustments
  • Start with subtle displacement values and increase as needed
  • Combine slow noise animation (0.05 - 0.1 multiplier) for atmospheric, cinematic effects
  • The combination of edge-only displacement with slow animation creates a “Euphoria-like” dreamy aesthetic

本教程介绍TouchDesigner中的图像位移技术,演示如何使用Displace TOP来变换和扭曲图像以创建创意效果。

理解Displace TOP

Displace TOP通过使用位移图像(输入1)来扭曲源图像(输入0)。当你首次添加Displace TOP时,会看到错误提示,因为它需要两个输入才能工作。

基本设置

  1. 添加一个Circle TOP作为源图像(将半径设为0.1 x 0.1)
  2. 添加一个Constant TOP作为位移图像
  3. 将Constant颜色设为0.5 x 0.5(50%灰色)
  4. 将Circle连接到输入0,Constant连接到输入1

50%灰色非常关键,因为它代表无位移——这与Source Midpoint参数相匹配。

关键参数

水平和垂直源

这些参数控制哪些颜色通道驱动位移:

  • Horizontal Source(水平源):红色通道(默认)
  • Vertical Source(垂直源):蓝色通道(默认)

一些用户喜欢使用绿色作为垂直位移,因为它通常与Y轴值相关联。

Source Midpoint(源中点)

默认设置为0.5 x 0.5。这指定了不产生位移的颜色值。任何高于或低于此中点的值都会导致相应方向的位移。

位移工作原理

  • 红色通道高于0.5:从右侧采样像素,图像向左位移
  • 红色通道低于0.5:从左侧采样像素,图像向右位移
  • 蓝色通道高于0.5:图像向下位移
  • 蓝色通道低于0.5:图像向上位移

注意:除非将绿色通道配置为位移源,否则它不会产生任何效果。

创建水波纹效果

设置

  1. 添加一个Movie File In TOP作为源图像
  2. 添加一个Noise TOP,设置:
    • Monochrome:关闭(以获得红色和蓝色通道变化)
    • Resolution:匹配源图像(例如1280 x 720)
  3. 将Movie File In连接到Displace TOP的输入0,Noise连接到输入1

Displace Weight(位移权重)

Displace Weight参数控制位移量:

  • 较高的值 = 更剧烈的扭曲
  • 较低的值 = 微妙的效果
  • 尝试0.05 x 0.05获得微妙的水波纹效果

动画噪声

在Noise TOP的Transform页面,为Translate TZ添加表达式:

absTime.seconds * 0.15

调整乘数以获得更快或更慢的动画。

噪声周期

增加Noise TOP上的Period参数可获得更大、更有机的扭曲和波动。

处理边缘伪影

Displace TOP上的Extend参数控制边缘的处理方式:

  • Hold:拉伸边缘像素(可能导致可见的伪影)
  • Zero:边缘无像素(创建旗帜飘动的效果)
  • Mirror:镜像像素值以获得更干净的边缘(推荐)

暗角位移效果

要仅在图像边缘应用位移(如相机镜头畸变):

  1. 在Noise TOP之后,插入一个Circle TOP
  2. 将Circle的Fill Color设为0.5 x 0.5(匹配Source Midpoint)
  3. Softness增加到约0.15以获得渐进过渡
  4. 将Noise的Amplitude降低到0.2以获得更微妙的效果

这样只在边缘创建位移,同时保持中心不失真。

通道遮罩

在Common页面,Channel Mask参数允许你选择性地将位移应用于特定通道:

  • 关闭红色可创建色差效果
  • 位移将影响绿色、蓝色和Alpha,同时保持红色不变

UV Weight实现色差效果

UV Weight参数创建额外的扭曲效果:

  • 接近1.0的值:正常行为
  • 接近0的值:放大位移效果
  • 尝试0.95获得微妙的色差效果

实用技巧

  • 使用鼠标中键进行精确的参数调整
  • 从微妙的位移值开始,根据需要增加
  • 结合缓慢的噪声动画(0.05 - 0.1乘数)可获得大气感、电影感的效果
  • 边缘位移与缓慢动画的组合可创建类似《亢奋》(Euphoria)的梦幻美学效果