Jump to content

Sign in to follow this  
newmethos

Cinema4D UDP Output Limits

Recommended Posts

Hello!

 

I am working on a pre-viz project for a piece of public art involving a DMX driven LED element. Ideally, I would use a plugin that turns Mograph color data into DMX (ArtNet, OSC, sACN, whatever you got) from Cinema4D, but it could be more generic output that I can then use for my DMX. It is essentially a live link but with DMX over EtherNet outputs (similar to something that Capture promises: https://www.capture.se/). I have not found that plugin and the promising ones are languishing in development to make the transition to macOS 10.15 (Catalina) and R21. 

 

So for now, I am using the Python effector to output Mograph color information over UDP, like this:

 

We started with Ken Komuro's video

 and

Alexander Gluschenko's tutorial on how to accomplish it: 

 

The code snippet I am using for the Python Effector comes from here: https://aturtur.com/mograph-to-launchpad/

 

import c4d
  import socket
  from c4d.modules import mograph as mo
   
  def initSocket():
  global s
  global server
  host = '127.0.0.1' # Host address
  port = 5001 # Port
  server = ('127.0.0.1', 5006) # Server address and server port
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # Initialize socket
  s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Re-use socket
  s.bind((host, port)) # Bind
  return s, server
   
  initSocket() # Create a socket
   
  def main():
  md = mo.GeGetMoData(op) # Get MoData
  if md is None: return False # If no MoData return false
  cnt = md.GetCount() # Get clone count
  carr = md.GetArray(c4d.MODATA_COLOR) # Get color array
  message = "" # Initialize message string
  row = 0 # Initialize row integer
  for i in xrange(0, cnt): # Loop through clones
  if i != 0: # If not the first index
  if i % 8 == 0:
  row = row + 8 # Launchpad pad numbering
  color = carr # Get clone's color

  index = (i+row) # Calculate pitch   message += str(index) + "-" + str(color.x) + "," # Write message   s.sendto(message, server) # Send message  

return True # Everything is fine

 

I have gotten this to work, or at least gotten the UDP data to output (we don't need to worry about the TouchDesigner part). However, the UDP information only shows up in TouchDesigner up to a cloner with 576 individual clones, after the grid array gets bigger than that, it receives nothing from Cinema4D. Our test LED wall has about twice that number of pixels, so it would be nice to model that accurately in Cinema 4D (I know that I can fake it with TouchDesigner workarounds, but I'd rather let Cinema do more of the work).

 

If anyone knows about a plugin that can output structured user data over a network where I can define my own messages, I'd be happy with that. If not, what UDP limitation am I running into here? It doesn't seem to be a TouchDesigner problem as it can receive UDP packets on the same port from other. But why would Cinema4D just stop sending data? I tried adding another light UDP server, but got no data out of C4D on that either. This is a very primitive server connection, so it could just be that, but I would love to know how to output more pixel data if I could.

 

Thanks for any help you can provide!

 

New Aspect Half Wall UDP Out.c4d

Share this post


Link to post
  • Topic Author
  • Update: As I was working with the Python console, I discovered that because the script is creating the variable message as a tuple, it was hitting the upper limits of the tuple object's memory. It also dramatically slowed Cinema4D down because tuples are immutables, so it was creating a new instance of the tuple over and over and over again in the for loop. I am working on a script that sends the integer data in "packets" of 512 channels (which will save you processing on the TouchDesigner side, since you are getting the universe data straight from Cinema), so the full size implementation of this idea for 1000+ pixels isn't done yet, but at least I know why it was happening.

    Share this post


    Link to post

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    Sign in to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×
    ×
    • Create New...