The Interactive & Immersive HQ

ChatGPT for TouchDesigner & Immersive Developers

ChatGPT is an impressive tool that you’ve almost certainly heard about in the news or in blog posts. You’ve also likely seen conversation about it replacing artists, writers, and coders. In this post, I’m going to show you a few ways you can use ChatGPT as a productive helper tool for interactive artists, immersive developers, and TouchDesigner users of all skill levels to improve your workflows and help you solve common problems.

Disclaimer

ChatGPT is not a real person or a pro. It is just trained on tons and tons of data. That means that there are certain biases it has because of the data used to train it. It also can present totally factually incorrect information in a very convincing manner, so none of these strategies replace working with/around pros or fact checking important information you’re trying to get out of the system. They also don’t fully replace existing tools and workflows yet, but they’re very promising and worth experimenting with!

Common coding questions

I’ve been doing development for a long time. Even with that under my belt, there are tons of things that I regularly have to look up because I don’t do them enough to have them in muscle memory. This can be random things like how to format the date in a specific way in Python or how to use Popen library to run an external process. My usual process involves looking it up on the web and landing on StackOverflow (which is an amazing workflow btw!). With these new tools we can have a different approach for this.

In this example, I can open up ChatGPT and put in a query like the following:

how can I get the date in Python 3 in this format: YYYY-MM-DD

We’ll see an output like this:

chatgpt touchdesigner

So a few things here. Firstly a lot of time you’ll also get a bit of pre-amble and explanation. Which is great if you’re learning coding for the first time. Second, you get a code example! This is great because I could copy and paste this right into something like TouchDesigner, run it and see if it works:

chatgpt touchdesigner

So great! But that was easy. What about something a bit more tricky? I mentioned Popen being something I have to use a few times a year and I never remember how to use it properly. I can type something like this into ChatGPT:

how can I use Popen to run a .py file on my computer in Python 3?

The immediate response is simple and to the point, which is great:

chatgpt touchdesigner

Now where ChatGPT starts to get really interesting is that it’s purpose is to be conversational. I know that there are differences between macOS and Windows and I’ve had experiences before with some things that access the OS working different between them. I can follow up to that directly with this question:

will this work on both macOS and Windows 11?

ChatGPT’s system holds the context (or thread) that you’re on with the system, so I don’t have to retype my question to give it the full context. And here’s what we see:

chatgpt touchdesigner

Great! So it immediately tells me the 2 likely things that might cause me issues. The first being the path to the .py file will need to be platform specific and that on Windows the Python binary might not be added automatically to the PATH environment variable, meaning we’ll need to specifically tell Popen where Python lives on the system. This is really powerful because how many times have you gone through StackOverflow and found yourself wanting a bit more context or having small questions about what you’re seeing? For me, it’s tons of times and this workflow is starting to become something I’m leaning into daily.

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.

Solving Workflows with ChatGPT for TouchDesigner

So the above examples were pretty straight forward. They revolved around getting a code sample on something common. Where ChatGPT becomes even more powerful of a learning tool is asking it questions about workflows, including for TouchDesigner. I can’t count the number of times on my hand that technical questions I hear about TouchDesigner are often simple math problems or operations and the problem is not that you can’t make it in TouchDesigner but that you don’t even know what to make. The beauty of ChatGPT is that we can ask it to explain concepts for us in a step by step format that we could then quickly and easily translate into TouchDesigner networks ourselves. Here’s some examples:

A common question I see a lot in the TouchDesigner world is how can I get one object to rotate and point at another object? Seems simple but if you don’t know a bit of the math behind it, it can feel like an impossible battle. So let’s ask ChatGPT for step by step instructions with this style of query:

give me step by step instructions on how I can make one object rotate towards another object given both of their XY positions

chatgpt touchdesigner

Fabulous. Now we’re starting to actually understand the process. So I need to do something called atan2 and then I need to convert radians to angles. Well, I have a giant TouchDesigner wiki I can search for those keywords in, and low and behold even without ever having known about it before, I can see that I have two operators that allow me to do this natively:

chatgpt touchdesigner

In a real world situation, I could jump into the documentation for them or check the Op Snippets for examples and dive into implementation immediately. If I didn’t want to do that natively, I could also jump back into ChatGPT and just ask for a whole Python example like this:

can you write a python script that does this?

And the results from ChatGPT come back with a code block with comments that I could copy and paste into TouchDesigner or any other platform of my choice.

chatgpt touchdesigner

I really hope you see the power of this tool. Not only can it help you in solving your problems but it also teaches how the solutions and workflows operate so that you can start to level up your abilities overall and understand what it actually happening in your projects.

Another quick example for fun, something I had to do recently and I had to look this up to figure out how to best implement this in TouchDesigner:

give me step by step instructions for how can I compare 3 colours (provided in RGB format) to a source colour (provided in RGB format) and determine which of the 3 colours is closest to the source colour

The response is really impressive and again highlights the power of ChatGPT.

chatgpt touchdesigner
chatgpt touchdesigner

If that doesn’t impress you, I don’t know what will! This gives us a step by step approach to implementation if we wanted to use native operators and a full Python example we can start with. Now, never having done this before and not being able to tell if this is “the Right Answer (TM)”, I can also ask it if there are other solutions to this problem, just for my own reference:

chatgpt touchdesigner

You could keep going down this rabbit hole and asking more information about those different methods to find the best option for you and likely even get a code block example! Really amazing stuff.

Rerun results if you don’t like the answer

There are tons of workflow tips on how to use ChatGPT, but one useful one is that if you get back an answer that sounds kind of wild or extremely convoluted, you can click the New Thread button in the top left or refresh your browser page (to clear the context you’re in) and run the same command again. Different results might come out that will be more useful.

Remember it can be totally wrong!

A fun example for you. As I was experimenting with the examples above for this post, I asked ChatGPT if it knew what kind of TouchDesigner operators I could use for applying those rotation calculations and the following answer came out, which is comically wrong and a great example of why you need to be careful:

chatgpt touchdesigner

There are no ATAN2 operators or * operators or ROT operators. Womp womp. Again, another real world example that these tools can be extremely helpful, but they might not know everything and more dangerously could present totally false information in a very convincing way. So keep your wits about you and ask someone more experienced if you have doubts about the results you’re getting!

GPT3 & TouchDesigner

To learn how to connect TouchDesigner with the GPT3 API (ChatGPT’s sibling), check out our tutorial here:

Wrap up: ChatGPT & TouchDesigner

ML and AI tools are here to stay and they’re only getting more and more powerful. While there are valid concerns about biases, training data, and ethics, this doesn’t mean that we can’t start trying to harness these tools to better our own workflows and processes. As long as you’re aware of potential issues (like wrong answers presented as correct answers) and have safeties and controls setup (like talking to your peers or people more knowledgable than you) then these tools could become hugely inspirational, educational, and productivity boosters for everyone.