A GDExtension plugin for Godot 4.0+ that provides ArtNet DMX transmission capabilities. This plugin wraps the lib-artnet-4-cpp library, enabling you to send ArtNet commands from GDScript.
Also see godot-artnet, which wraps the more-stable libartnet library.
- Send DMX512 data over Art-Net protocol
- Support for multiple universes
- Thread-safe operations
- Simple GDScript API
- Cross-platform support (Linux, macOS, Windows, Android, iOS)
- Godot 4.1 or higher
- C++17 compatible compiler
- CMake 3.17 or higher (for CMake builds)
- SCons (for SCons builds)
- Network connectivity for ArtNet transmission
git clone https://github.com/jecortez/godot-artnet.git
cd godot-artnetThis project depends on godot-cpp and lib-artnet-4-cpp as git submodules:
git submodule update --init --recursivesconsThis will build the extension and copy it to the demo/bin/ directory for your platform.
mkdir build
cd build
cmake ..
makeThe compiled library will be in bin/<platform>/ directory.
extends Node
var artnet: ArtNetController
func _ready():
artnet = ArtNetController.new()
# Configure ArtNet controller
# Parameters: bind_address, port, net, subnet, universe, broadcast_address
if not artnet.configure("0.0.0.0", 6454, 0, 0, 0, "255.255.255.255"):
print("Failed to configure ArtNet controller")
return
# Start the controller
if not artnet.start():
print("Failed to start ArtNet controller")
return
# DMX sending is automatically enabled when the controller starts
# Optional: Disable it if needed with artnet.set_enable_sending_dmx(false)
print("ArtNet controller started")
func _process(_delta):
# Create DMX data (512 channels)
var dmx_data := PackedByteArray()
dmx_data.resize(512)
# Set DMX channel values (0-255)
dmx_data[0] = 255 # Channel 1 at full intensity
dmx_data[1] = 128 # Channel 2 at half intensity
# ... set other channels as needed
# Set and send DMX data
if artnet.set_dmx_data(0, dmx_data):
artnet.send_dmx()
func _exit_tree():
if artnet:
artnet.stop()To send ArtNet data on your network, you need to configure the bind address and broadcast address. The bind address is your computer's IP address on the network, and the broadcast address is used to send packets to all devices on your network segment.
- Open Terminal
- Run the following command to find your IP address and broadcast address:
ifconfig | grep "inet " | grep -v "127.0.0.1"
- Look for a line like:
inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255- Bind Address:
192.168.1.100(the IP address) - Broadcast Address:
192.168.1.255(the broadcast address)
- Bind Address:
Alternatively, you can use:
ipconfig getifaddr en0 # Replace en0 with your interface name-
Open Terminal
-
Run one of these commands:
Using
ipcommand (modern):ip addr show
Look for your network interface (usually
eth0,wlan0, orenp0s3) and find:- Bind Address: The
inetvalue (e.g.,192.168.1.100) - Broadcast Address: The
brdvalue (e.g.,192.168.1.255)
Using
ifconfigcommand:ifconfig
Look for your network interface and find:
- Bind Address: The
inetvalue - Broadcast Address: The
broadcastvalue
Quick method:
hostname -I # Shows your IP address ip route | grep default # Shows default route info
- Bind Address: The
-
Open Command Prompt or PowerShell
-
Run:
ipconfig -
Look for your active network adapter (usually "Ethernet adapter" or "Wireless LAN adapter")
-
Find:
- Bind Address: The
IPv4 Addressvalue (e.g.,192.168.1.100) - Broadcast Address: Calculate from your IP and subnet mask:
- If subnet mask is
255.255.255.0, broadcast is192.168.1.255 - If subnet mask is
255.255.0.0, broadcast is192.168.255.255 - Generally: replace the host portion (last octet for /24) with
255
- If subnet mask is
Using PowerShell (more detailed):
Get-NetIPAddress | Where-Object {$_.AddressFamily -eq 'IPv4' -and $_.IPAddress -notlike '127.*'}
- Bind Address: The
- 192.168.x.x: Most home/office networks (subnet mask usually 255.255.255.0, broadcast: 192.168.x.255)
- 10.x.x.x: Corporate networks (subnet mask varies)
- 172.16.x.x - 172.31.x.x: Private networks (subnet mask varies)
Note: On macOS, binding to 0.0.0.0 and broadcasting to 255.255.255.255 may not work. It's recommended to use your specific network interface IP address and the network's broadcast address.
The main class for ArtNet operations.
-
configure(bind_address: String, port: int, net: int, subnet: int, universe: int, broadcast_address: String = "255.255.255.255") -> boolConfigures the ArtNet controller with network and universe settings.
bind_address: Local IP address to bind to (use "0.0.0.0" to bind to all interfaces)port: UDP port to use (default Art-Net port is 6454)net: Art-Net net value (0-127)subnet: Art-Net subnet value (0-15)universe: Art-Net universe value (0-15)broadcast_address: Broadcast address to send packets to (default: "255.255.255.255")
Returns
trueif configuration was successful. -
start() -> boolStarts the ArtNet controller and begins network operations.
Returns
trueif started successfully. -
stop() -> voidStops the ArtNet controller and stops all network operations.
-
is_running() -> boolReturns
trueif the controller is currently running. -
set_enable_sending_dmx(enable: bool) -> voidEnables or disables DMX transmission. DMX sending is automatically enabled when the controller is started via
start(). You can use this method to disable sending (by passingfalse) or re-enable it (by passingtrue) as needed. When disabled,send_dmx()will returntruewithout sending any packets. -
set_dmx_data(universe: int, data: PackedByteArray) -> boolSets the DMX data for a specific universe. The data array should contain up to 512 channel values (0-255).
universe: The universe number to set data fordata: A PackedByteArray containing DMX channel values (0-255)
Returns
trueif the data was set successfully. -
send_dmx() -> boolSends the configured DMX data as an ArtNet packet.
Returns
trueif the packet was sent successfully.Note: DMX sending is automatically enabled when the controller starts. If sending has been disabled using
set_enable_sending_dmx(false), this method will returntruewithout sending any packets.
Art-Net is a protocol for transmitting DMX512 data over Ethernet networks. It's commonly used in professional lighting control systems.
Art-Net uses a three-level addressing scheme:
- Net: 0-127 (high-level network)
- Subnet: 0-15 (sub-network within a net)
- Universe: 0-15 (universe within a subnet)
The total number of addressable universes is: Net × 16 × 16 = up to 32,768 universes.
Each universe supports up to 512 DMX channels, with values ranging from 0-255.
A demo project is included in the demo/ directory. Open it in Godot to see working examples of ArtNet transmission.
The demo project includes two example scenes that demonstrate different use cases:
A simple example that demonstrates basic ArtNet DMX transmission. This example:
- Sends random DMX values to all 512 channels
- Updates every 0.5 seconds
- Shows the basic setup and configuration process
- Perfect for testing ArtNet connectivity
Key Features:
- Simple, straightforward implementation
- Random DMX data generation
- Configurable send interval
- Full universe (512 channels) transmission
Usage:
- Update
BIND_ADDRESSandBROADCAST_ADDRESSinexample.gdto match your network configuration (see Network Configuration) - Run the scene in Godot
- The example will start sending random DMX data on universe 1
An advanced visual demo that creates a 3D scene with animated orbs and real-time DMX output. This example:
- Creates a 4×4 grid of 16 colored orbs in a 3D scene
- Each orb smoothly transitions between random colors every 2 seconds
- Maps each orb's RGB color to 3 DMX channels (48 total channels)
- Sends DMX data every 10ms for smooth, real-time updates
- Features a sky, ambient lighting, and plastic-like orb materials
Key Features:
- Visual 3D representation of DMX fixtures
- Real-time color-to-DMX mapping
- Smooth color interpolation
- High-frequency DMX updates (100 Hz)
- Professional lighting visualization
DMX Channel Mapping:
- Orb 0: Channels 1-3 (Red, Green, Blue)
- Orb 1: Channels 4-6 (Red, Green, Blue)
- Orb 2: Channels 7-9 (Red, Green, Blue)
- ... and so on for all 16 orbs
Each orb uses 3 consecutive DMX channels for RGB color control, making it compatible with standard RGB DMX fixtures.
Usage:
- Update
BIND_ADDRESSandBROADCAST_ADDRESSinlight_demo.gdto match your network configuration - Run the scene in Godot
- Watch the orbs change colors and see the DMX data being transmitted in real-time
- Connect your ArtNet-compatible RGB fixtures to see them respond to the color changes
Scene Features:
- Sky with procedural sky material
- Ambient lighting for better visualization
- Floor plane for spatial reference
- Camera positioned to view all orbs
- Plastic-like materials on orbs with emission and clearcoat for realistic appearance
Customization:
You can easily customize the demo by modifying constants in light_demo.gd:
GRID_SIZE: Change the grid size (currently 4×4 = 16 orbs)COLOR_CHANGE_INTERVAL: How often colors change (default: 2.0 seconds)DMX_SEND_INTERVAL: DMX update frequency (default: 0.01 seconds = 100 Hz)UNIVERSE: ArtNet universe number (default: 1)
The extension supports building for:
- macOS (Intel and Apple Silicon)
- Linux (x86_64, ARM64, RISC-V)
- Windows (x86_32, x86_64)
- Android (x86_64, ARM64)
- iOS (ARM64)
Build artifacts are placed in bin/<platform>/ and automatically copied to demo/bin/<platform>/ when using SCons.
This extension does not support the Web/Emscripten platform. Art-Net is a UDP-based networking protocol that requires direct socket access to send and receive packets on the local network. Web browsers operate in a sandboxed environment that does not allow:
- Direct UDP socket access: Browsers cannot create UDP sockets, which are required for Art-Net communication
- Local network broadcasting: Art-Net relies on UDP broadcast to discover and communicate with devices on the local network, which is not possible from a browser
- Low-level networking: The Web platform only supports HTTP/HTTPS, WebSocket, and WebRTC protocols, none of which are compatible with Art-Net
If you need to control Art-Net devices from a web browser, consider:
- Running a native application or server that acts as a bridge between WebSocket connections and Art-Net
- Using a dedicated lighting control application on the same machine as the Godot game
- Ensure your network interface is properly configured
- Check that the specified port (default 6454) is not in use
- Verify firewall settings allow UDP traffic on the ArtNet port
- Verify the broadcast address matches your network configuration
- Check that Art-Net net, subnet, and universe values are correct
- Ensure the receiving device is on the same network segment
Contributions are welcome! Please feel free to submit issues or pull requests.
This project is licensed under the same license as the template it's based on. The lib-artnet-4-cpp library is licensed under GPL-3.0.
- lib-artnet-4-cpp by Gaston Morixe
- godot-cpp by the Godot Engine team
- Based on the official Art-Net 4 Protocol Specification