Skip to main content

TSMPEncoder

Use TSMPEncoder on the sender side. It writes TSMP data into an output render texture.

Most users configure it through TSMPSetup instead of editing every field directly.

What you need

  • An output RenderTexture.
  • The Luma4 handler selected through TSMPSetup.
  • At least one enabled TSMP network component, or a queued RPC call.
  • Enough payload capacity for the selected data.

How to use it

  1. Assign the output texture through TSMPSetup.
  2. Choose Luma4 through the Codec tab.
  3. Set the target frame rate.
  4. Click Apply Setup.
  5. Watch the output texture while synchronized objects move.

The output texture should visibly change when payload data changes. If it stays flat or only shows a static pattern, check setup references and payload diagnostics.

What the output should look like

A healthy TSMP output usually has:

  • A structured header area.
  • A changing payload area when synchronized values change.
  • Empty black or unused space when the texture has more capacity than the current payload needs.

Old blocks should not remain after changing settings or payload size. If they do, make sure output clearing is enabled and the output render texture is the one being displayed.

Payload and capacity

The encoder builds one payload per frame. Payload contains:

  • Variable state messages from [TransSync] fields.
  • RPC messages queued by SendTransRPC.

If the payload is too large, the encoder logs Payload buffer is full and cannot include everything. Reduce synchronized data first, then increase texture capacity if needed.

High-bandwidth sources include:

  • Full VRChat avatar pose sync.
  • Humanoid pose with many bones.
  • Large blend shape selections.
  • Many active players.
  • Many independent transform objects.

RPC use

From a TSMPNetworkBehaviour, call:

SendTransRPC(nameof(MyMethod), RPCTarget.All);

The encoder includes queued RPCs in the payload for several frames so short events are less likely to be missed by the texture transport.

Targets:

TargetSenderReceiver
LocalRuns immediately.Not sent.
RemoteDoes not run locally.Runs after decode.
AllRuns immediately.Runs again after decode.

Runtime diagnostics

Important fields and warnings:

DiagnosticMeaning
Frame indexIncreases when frames are being encoded.
Payload bytesNumber of payload bytes written this frame.
Message countNumber of network messages in the payload.
Payload buffer is fullCurrent frame cannot fit all synchronized data.
Failed to write TSMP valueA field could not be encoded.
Missing codec or output textureThe encoder cannot produce a valid frame.

Common fixes

SymptomTry this
Frame index does not increaseEnable auto encode or call Encode Now from the Debug tab.
Payload is always zeroAdd an enabled TSMP network component and run Apply Setup.
Payload buffer is fullReduce synced data or increase output capacity.
RPC is missedCheck frame loss and keep RPC repeat frames enabled.
Output looks unchanged after codec changeRe-run Apply Setup and confirm the output render texture is cleared.