The Interactive & Immersive HQ

Get DMX Into Unreal Engine from TouchDesigner

Among the many features that have been added to Unreal Engine over the past few years to help position it as a useful tool for interactive and immersive experiences is the inclusion of native DMX support and an accompanying set of tools. Now, Unreal Engine can both receive and send DMX, allowing it to be used for ultra realistic previz and testing or even for controlling fixtures in real-time. Still, it can be useful to integrate the program with programs like TouchDesigner for the ability to rapidly prototype DMX control signal functionality. In this post, we’ll set up an example project to send DMX from TouchDesigner into Unreal Engine via the Art-Net protocol.

Setting Up Unreal Engine to Receive DMX from TouchDesigner

In Unreal Engine, we’re going to use a handy DMX template as a starting point. This template is great for testing DMX connectivity, as it has a bunch of virtual fixtures already set up and ready to receive data.

In the New Project dialog, head to the Film/Video & Live Events category and select the DMX template. Give the project a name, and click create.

DMX Into Unreal Engine
New Project Dialog

Once the project file has been compiled and loaded, you should see a level that looks like the image below. It’s filled with lots of different types of lights (all controllable via DMX) and has the required plugins already set up!

DMX Into Unreal Engine
DMX Template Project on First Open

Unreal Engine DMX Plugins

This template comes with a total of five DMX-related plugins activated (see image below), not all of which we’ll be taking advantage of. It’s important to note, however, that at minimum the DMX Engine and DMX protocol plugins have to be enabled to start working with DMX in Unreal Engine. So if you want to implement the functionality in a project of your own, you’ll need to activate at least these two plugins. Along with these, the DMX Fixtures and DMX Control Console plugins are worth looking into, as they provide some functionality that makes things easier to get set up and test.

DMX Into Unreal Engine
Plugins Window for DMX Template Project

Setting Input IP Address for DMX Plugins

To enable our project to receive DMX from TouchDesigner, we need to make sure that we’ve set the input IP address correctly. Head to the Project Settings window, and find the DMX page under Plugins on the left hand side of the window.

Here, you’ll find all settings related to the DMX plugins, including communication settings (inputs and outputs) and fixture settings. The parameter we’re looking for is called Network Interface Card IP Address, and is found under Communication Settings -> Input Ports -> Index [0]. This should be set to 127.0.0.1 so that we can receive data from a local instance of TouchDesigner.

DMX Into Unreal Engine
Project Settings Window for DMX Template Project

With that step complete, we should be able to receive DMX input from TouchDesigner! Before we move on, however, we need to figure out which DMX addresses the virtual fixtures have been assigned to (which is called Fixture Patching in Unreal), so that we can send the data from TouchDesigner to the right place.

DMX Into Unreal Engine

To see the current patching of the fixtures, we need to find the DMX Library asset that contains the patch and fixture database, which has been titled DMXLib_Fixtures in this template. In the Content Browser, head to Content/DMXTemplate/DMX/ and click on DMXLib_Fixtures. You should then see a window that looks like the one below. If the window looks different, check that you’re viewing the Fixture Patch tab, which contains the information we want to look at.

DMX Into Unreal Engine
Fixture Patch Window

In this window, we can see the fixtures currently active/patched in the scene, meaning they are set up to receive/respond to DMX input. On the left, we have a list of all the fixtures, their ID, type, mode, and patch (which shows universe and channel). On the upper right, there is a very useful visualization of the mapping of each fixture to the channels in the universe. It’s helpful to tick the checkbox for the option Show all patched Universes to see all universes that have fixtures patched to them.

In this case, we have fixtures patched in universes 1 and 2, with a wide range of addresses, spanning most of the 512 channels of the first universe and about half of the second. Now that we have that confirmed, we can head over to TouchDesigner.

Setting Up TouchDesigner to Send DMX to Unreal Engine

In TouchDesigner, we’re going to keep things pretty simple for the sake of illustration. In the end, we’ll have a simple square wave on/off signal sent to all DMX channels in universe 1 and some in universe 2. They’ll be slightly offset in time so that the lights cycle sequentially, rather than all at the same time. Although not all channels will be utilized on Unreal Engine’s end, it’ll be quick and easy to set up in TouchDesigner.

To generate the CHOP data for DMX control of the lights, we’ll be using a Pattern CHOP. Add one to your network, and then make the following changes:

  • Set the Type parameter to Square.
  • Set the Length parameter to 818. This corresponds to the total number of DMX channels we’ll be controlling.
  • Set the Number of Cycles parameter to 50.
  • Set the Phase to absTime.seconds * 0.25, which will start animating the channel content.
DMX Into Unreal Engine

In this example, each of the 818 samples of the Pattern CHOP will correspond to one DMX channel. Since DMX universes are limited to 512 channels, we’ll have to split this data across multiple universes in order to send it to Unreal. An easy way to do this is by using the Trim CHOP.

Setting Up Data for Universe 1

Attach the Trim CHOP to the pattern1 CHOP. In the parameter window, make the following changes:

  • Set the Unit Values parameter to Absolute.
  • Set the End parameter to 511.

Now, we need to convert from a single multi-sample CHOP channel to multiple single sample CHOP channels. Attach a Shuffle CHOP and set the Method parameter to Swap Channels and Samples. Attach a Null CHOP, rename it to “null_u1” and you’ve got the data for Universe 1 ready!

Get Our 7 Core TouchDesigner Templates, FREE

We’re making our 7 core project file templates available – for free.

These templates shed light into the most useful and sometimes obtuse features of TouchDesigner.

They’re designed to be immediately applicable for the complete TouchDesigner beginner, while also providing inspiration for the advanced user.

Setting Up Data for Universe 2

Since the operators required for the second universe of data are the same, we’ll start by simply copying and pasting the branch of the network starting with the trim1 CHOP and ending with the null_u1 CHOP we just created (essentially, everything at this point besides the Pattern CHOP). We’ll paste this directly below the current branch.

Our main changes will take place in the trim2 CHOP. Here, we need to change the start and end values to isolate the samples we need:

  • Set the Start parameter to 512.
  • Set the End parameter to 817.
DMX Into Unreal Engine
Completed CHOP Networks for Universe 1 and Universe 2 Data

Once this is complete, we need to take this data and actually send it over to Unreal Engine! We’ll be doing this via the DMX Out CHOP, which will send the data over to Unreal using Art-Net. Add two DMX Out CHOPs to the network, and connect them to the null_u1 and null_u2 CHOPs. In the parameter window of both DMX Out CHOPs, change the following:

  • Set the Interface parameter to Art-Net.
  • For the DMX Out CHOP connected to null_u1, set the Universe parameter to 1. For the DMX Out CHOP connected to null_u2, set the Universe parameter to 2.
  • On the Network page, set the Local Address parameter to 127.0.0.1.
DMX Into Unreal Engine
Final CHOP Network with DMX Out CHOPs Added

Once complete, the data should start sending immediately. Let’s take a look in Unreal Engine to find out!

The Moment of Truth…

Success! We’ve got a nice light show complete with lasers and pyrotechnics to celebrate our hard work. Now that the connection has been made, you can experiment with all kinds of different CHOP-based signals to generate different results. By sending data to specific channels (which you can find in the Fixture Patch window in Unreal) you can control each fixture independently. As usual, there’s lots to explore!

DMX Into Unreal Engine

Wrap-Up

As you can see from this example, the integration of DMX support into Unreal Engine makes it pretty straightforward to control virtual fixtures within the scene. And of course, the quality of the results along with the DMX compatibility means that it makes for an even more useful previz tool than ever before. We’ve only scratched the surface of the many possibilities for working with DMX, Unreal Engine and TouchDesigner, but hopefully this post has gotten you excited to learn more and explore on your own!