VRSL_GridReader component is an editor-only utility that receives OSC (Open Sound Control) data from the VRSL Grid node and writes it to a texture buffer. This enables real-time DMX visualization and testing in the Unity Editor.
Editor Only: This component only functions in the Unity Editor and is automatically disabled in builds. It is used for development and testing purposes.
Overview
The Grid Reader establishes an OSC listener that receives DMX channel data from VRChat and writes it to aTexture2D buffer. This texture is then used by VRSL shaders to control lighting fixtures in real-time during editor testing.
Inspector Properties
Configuration
Enable if using the grid node in vertical mode. Affects how DMX channels are mapped to texture coordinates.
- Vertical Mode: 13 columns × 67 rows (871 channels)
- Horizontal Mode: 120 columns × 13 rows (~1560 channels)
Enable if you are using RGB mode to use additional universes. When enabled:
- Separate RGB channels for expanded color support
- Supports up to 9 universes with color splitting
- When disabled, uses single-channel grayscale mode
The OSC port to listen on. Must match the port configured in the VRSL grid node.
OSC address prefix assigned in the VRSL grid node. Must match exactly for proper communication.
Internal Properties
DO NOT EDIT: Internal texture buffer that stores DMX channel data. This texture is automatically generated and managed by the component.The texture dimensions depend on the mode:
- Vertical: 208×1072 pixels (16×16 pixel blocks per channel)
- Horizontal: 1920×208 pixels (16×16 pixel blocks per channel)
How It Works
Data Flow
- OSC Reception: Listens for OSC packets on
_OSCPort + 1 - Data Parsing: Extracts DMX channel, R, G, B values from OSC messages
- Buffer Writing: Writes color data to corresponding texture pixels
- Texture Update: Applies changes to
_DataBuffertexture - Shader Access: VRSL shaders read from the texture to control fixtures
Channel Mapping
Each DMX channel is represented by a 16×16 pixel block in the texture: Standard Mode (_ExpandedUniverseSupport = false):
- All RGB channels set to same value (grayscale)
- Single universe support
- R = G = B = DMX value / 255
_ExpandedUniverseSupport = true):
- Separate RGB values per channel
- Multi-universe support via color splitting
- R = Red channel value / 255
- G = Green channel value / 255
- B = Blue channel value / 255
Coordinate System
Vertical Mode:Configuration Steps
Basic Setup
- Add
VRSL_GridReadercomponent to a GameObject in your scene - Create a new
Texture2Dasset for the_DataBuffer:- Vertical: 208×1072, RGBA32, Point filtering
- Horizontal: 1920×208, RGBA32, Point filtering
- Assign the texture to
_DataBufferfield - Match
_IsVerticalto your grid node orientation - Set
_OSCPortto match your grid node configuration - Set
_OSCPrefixto match your grid node prefix
Grid Node Configuration
In VRChat, configure your VRSL Grid node:- Set OSC output port to match
_OSCPort(default: 12000) - Set OSC prefix to match
_OSCPrefix(default: /VRSL) - Choose Vertical or Horizontal orientation
- Enable RGB mode if using expanded universe support
- Set your local IP address as the OSC destination
Testing Connection
- Enter Play Mode in Unity Editor
- In VRChat, join your world with the VRSL Grid node
- Send DMX data from your lighting software
- Check the Console for “GridReader Init” message
- Verify fixtures respond to DMX input
Example Setup
Standard Vertical Configuration
Horizontal RGB Mode
Troubleshooting
No Data Received
Check Console Messages:- “GridReader Init” - Component started successfully
- “GridReader failed to launch” - Port conflict or initialization error
- OSC port matches grid node configuration
- OSC prefix matches exactly (case-sensitive)
- Firewall allows UDP traffic on the port
- VRChat is running and world is loaded
Incorrect Fixture Response
Orientation Mismatch:- Ensure
_IsVerticalmatches grid node orientation - Vertical mode uses 13-wide layout
- Horizontal mode uses 120-wide layout
- Match
_ExpandedUniverseSupportto grid node RGB mode - Standard mode: single channel values
- Expanded mode: separate RGB channels
Performance Issues
Update Frequency:- Grid Reader updates every frame in Update()
- Only updates pixels that have changed
- Texture.Apply() is called once per frame
- Vertical: ~850 KB texture
- Horizontal: ~1.5 MB texture
- Color buffer arrays: ~3.5 KB
Technical Details
OSC Message Format
Standard Mode:Pixel Block Layout
Each 16×16 pixel block stores a single DMX channel:Thread Safety
The OSC listener runs on a separate thread:- Callback receives data asynchronously
- Writes to
_Bufarray (thread-safe for simple writes) - Main thread reads from
_Bufin Update() - No locks needed due to write-once-per-frame pattern
Integration with Other Components
VRSL_LocalUIControlPanel
The Control Panel component manages which grid mode is active:DMXMode = 0: Horizontal grid texturesDMXMode = 1: Vertical grid texturesDMXMode = 2: Legacy grid textures
VRStageLighting_DMX_Static
DMX fixtures read from the texture buffer:- Calculate texture coordinates from DMX channel/universe
- Sample color from appropriate pixel block
- Apply color and intensity to shader
Grid Node (In VRChat)
The VRChat Grid Node:- Receives DMX via OSC or Art-Net
- Transmits to Unity Editor via OSC
- Handles universe splitting and routing
- Provides UI for configuration
Performance Optimization
Update Optimization
- Uses
_NeedsUpdateboolean array to track changed channels - Only updates texture pixels that have new data
- Single
Texture2D.Apply()call per frame
Memory Efficiency
- Reuses color array for pixel data (256 pixels)
- Buffers are allocated once in Start()
- No per-frame allocations
Limitations
- Editor Only: Does not function in builds
- Local Only: Requires VRChat running on same machine
- Network Delay: OSC transmission adds ~10-50ms latency
- Channel Limit:
- Vertical: 871 channels (67 universes @ 13 channels)
- Horizontal: 1560 channels (120 universes @ 13 channels)
See Also
- DMX Static Component - Fixtures that read Grid Reader data
- Local UI Control Panel - Grid mode management
- OSC Documentation - OSC protocol reference