Creating shadows in TouchDesigner requires a few extra steps when setting up your render network. This tutorial walks through the complete process of configuring lights and shadows for realistic 3D scenes.

Setting Up the Basic Network

Required Components

Start by opening the OP Create dialog and adding these components:

  1. Camera with a Null (for look-at targeting)
  2. Light with a Null (for look-at targeting)

Using Null components as look-at targets makes it easier to position elements spatially in your scene.

Adding Geometry

From the Surface Operators (SOP) family, add:

  1. Rectangle SOP - This will serve as the ground plane

    • Change orientation to ZX (instead of XY)
    • Set size to 10 by 10
  2. Box SOP - This will cast shadows

    • Set Center Y to 0.5 so it sits on top of the plane

Applying Materials

For each piece of geometry:

  1. Add a Phong MAT from the Material family
  2. Drag the material onto the geometry to assign it
  3. Set different diffuse colors (e.g., dark blue for the plane, orange for the box) to distinguish objects

Creating Geometry Components

Right-click on each SOP output and select Components > Geometry to create geometry components that can be rendered.

Using the Geometry Viewer

Split your view and change one pane to Geometry Viewer. This allows you to see your scene from multiple angles while working, helping you understand the spatial relationships between camera, light, and geometry.

Configuring the Camera

  1. Add a Render TOP to your network
  2. Set the camera’s look-at parameter to use Null1
  3. Transform the camera:
    • Move up slightly in Y
    • Adjust X position for a better vantage point
  4. Press P to close the parameter window for a cleaner view

Configuring the Light

Light Type

By default, lights are configured as Point lights. For shadows to work effectively:

  1. Go to the Light page
  2. Change the light type to Cone Light
  3. Adjust the cone angle to illuminate more of your scene

Light Position

  1. Set the light’s look-at parameter to use Null2
  2. Transform the light position:
    • Move up in Y for overhead lighting
    • Adjust Z position (e.g., 5) to bring it closer to the scene

Enabling Shadows

By default, shadows are turned off in TouchDesigner. To enable them:

  1. Select your Light component
  2. Go to the Shadow page
  3. Change the shadow parameter from “Off” to Soft 2D Mapped

You should immediately see shadows appear in your render.

Shadow Casters Parameter

On the Shadow page, the Shadow Casters parameter specifies which components cast shadows:

  • An asterisk (*) means all geometry components in the network will cast shadows
  • You can specify individual components if needed

Understanding Light Visibility with Depth TOP

To visualize what your light can “see” (and therefore what can cast shadows):

  1. Add a Depth TOP to your network
  2. Drag your Light component onto the Depth TOP
  3. Configure the Depth TOP:
    • Change pixel format to 8-bit
    • Set depth space to “Rearranged Camera Space”

The Depth TOP shows the boundaries of what your light can see. This is crucial because:

  • Only objects visible to the light can cast shadows
  • If geometry is outside the light’s view, it won’t cast shadows in your scene

Key Takeaways

  1. Shadows require explicit setup - They are off by default and must be enabled on the Light component
  2. Use Cone Lights for shadows - Point lights work differently; cone lights give more predictable shadow behavior
  3. Look-at targets simplify positioning - Using Null components as look-at targets makes it easier to aim cameras and lights
  4. Shadow casters must be visible to the light - Use Depth TOP to verify what your light can see
  5. Soft 2D Mapped shadows provide realistic soft-edged shadows suitable for most scenes
  6. The asterisk (*) in Shadow Casters includes all geometry components by default

Workflow Summary

  1. Set up Camera and Light with Null look-at targets
  2. Create geometry (ground plane + objects)
  3. Apply materials with distinct colors
  4. Configure Light as Cone Light
  5. Enable Soft 2D Mapped shadows
  6. Use Depth TOP to verify light coverage
  7. Adjust positions until shadows render correctly

在TouchDesigner中创建阴影需要在设置渲染网络时进行一些额外步骤。本教程将完整介绍如何为逼真的3D场景配置灯光和阴影。

设置基础网络

所需组件

首先打开OP创建对话框,添加以下组件:

  1. 相机(Camera) 配合一个 Null(用于look-at目标)
  2. 灯光(Light) 配合一个 Null(用于look-at目标)

使用Null组件作为look-at目标可以更轻松地在场景中定位元素。

添加几何体

从表面操作符(SOP)家族中添加:

  1. Rectangle SOP - 作为地面平面

    • 将方向改为ZX(而非XY)
    • 设置尺寸为10 x 10
  2. Box SOP - 用于投射阴影

    • 将中心Y设为0.5,使其位于平面上方

应用材质

为每个几何体:

  1. 从材质家族添加 Phong MAT
  2. 将材质拖到几何体上进行分配
  3. 设置不同的漫反射颜色(例如,平面用深蓝色,盒子用橙色)以区分对象

创建几何体组件

右键点击每个SOP输出,选择组件 > 几何体来创建可渲染的几何体组件。

使用几何体查看器

分割视图并将一个面板改为几何体查看器。这样可以在工作时从多个角度查看场景,帮助理解相机、灯光和几何体之间的空间关系。

配置相机

  1. 向网络添加 Render TOP
  2. 将相机的look-at参数设置为使用Null1
  3. 变换相机:
    • 在Y轴上稍微上移
    • 调整X位置以获得更好的视角
  4. 按P键关闭参数窗口以获得更清晰的视图

配置灯光

灯光类型

默认情况下,灯光配置为点光源。为使阴影有效工作:

  1. 进入Light页面
  2. 将灯光类型改为 锥形光(Cone Light)
  3. 调整锥角以照亮更多场景

灯光位置

  1. 将灯光的look-at参数设置为使用Null2
  2. 变换灯光位置:
    • 在Y轴上移以实现顶部照明
    • 调整Z位置(例如5)使其更靠近场景

启用阴影

默认情况下,TouchDesigner中的阴影是关闭的。要启用它们:

  1. 选择灯光组件
  2. 进入 Shadow 页面
  3. 将阴影参数从”Off”改为 Soft 2D Mapped

你应该立即在渲染中看到阴影出现。

阴影投射者参数

在Shadow页面上,Shadow Casters 参数指定哪些组件投射阴影:

  • 星号(*)表示网络中所有几何体组件都将投射阴影
  • 如需要可以指定单个组件

使用Depth TOP理解灯光可见性

要可视化灯光能”看到”什么(因此什么能投射阴影):

  1. 向网络添加 Depth TOP
  2. 将灯光组件拖到Depth TOP上
  3. 配置Depth TOP:
    • 将像素格式改为8位
    • 将深度空间设为”Rearranged Camera Space”

Depth TOP显示灯光能看到的边界。这很关键,因为:

  • 只有灯光可见的对象才能投射阴影
  • 如果几何体在灯光视野之外,它不会在场景中投射阴影

关键要点

  1. 阴影需要显式设置 - 默认关闭,必须在灯光组件上启用
  2. 使用锥形光实现阴影 - 点光源工作方式不同;锥形光提供更可预测的阴影行为
  3. Look-at目标简化定位 - 使用Null组件作为look-at目标使相机和灯光的瞄准更容易
  4. 阴影投射者必须对灯光可见 - 使用Depth TOP验证灯光能看到什么
  5. Soft 2D Mapped阴影 提供适合大多数场景的逼真柔和边缘阴影
  6. Shadow Casters中的星号(*) 默认包含所有几何体组件

工作流程总结

  1. 设置带有Null look-at目标的相机和灯光
  2. 创建几何体(地面平面 + 对象)
  3. 应用具有不同颜色的材质
  4. 将灯光配置为锥形光
  5. 启用Soft 2D Mapped阴影
  6. 使用Depth TOP验证灯光覆盖范围
  7. 调整位置直到阴影正确渲染