Home

Awesome

Blender Render Engine for Unity MeshSync

This package streams rendered frames from Unity to Blender.

It's especially useful when combined with the Unity MeshSync package to see (in-game render) changes directly in Blender.

It can be challenging/impossible to match lighting and shading between Blender and Unity, this two-part solution makes sure that what's visible in Blender while editing is identical to in-game results.

Not affiliated with Unity.

Contents

Requirements

Setup

Unity

Blender

Usage & Settings

Quickstart

Blender Settings

The settings are in the Tools tab, just underneath the MeshSync settings:

When Auto-Connect is enabled MeshSync Render Engine will connect and disconnect when MeshSync connects or disconnects. This avoids having to manage the two connections separately.

Unity Settings

The settings are in Edit > Project Settings > MeshSync Render Engine:

Camera Factory

Assign a Camera Factory to configure the stream camera, ex to set a specific anti-aliasing mode. When none is assigned a default factory is used.

A utility Camera Prefab Factory is also provided (Create > MeshSync Render Engine > Camera Prefab Factory). It copies the camera settings from a specified prefab and (optionally) instantiates a specified child prefab onto the GameObject:

Alternatively a custom factory can be coded by inheriting from CameraFactory.cs.

Debug Logs

Logging in Unity can be configured in Window > MeshSync Render Engine > Health Monitor:

The Show GameObjects setting is particularly useful: it allows to inspect the otherwise hidden temporary objects added to the scene that implement the offscreen rendering and streaming.

Logging in Blender can be configured in the addon settings:

Limitations

Editor Refresh & DLL Hooks & Anti-Virus

Normally the Unity editor stops rendering when it's in the background. This is an issue because it prevents Unity from sending frames to Blender.

The current solution is to make the Unity editor think that it's always in the foreground while this package is actively streaming to Blender.

This is done by hooking the GetForegroundWindow function at the DLL level using the Detours library. This works like a charm but it can trip some anti-virus software.

Acknowledgments