google-deepmind / google-deepmind/mujoco

Unity importer creates URP-incompatible materials that render magenta

Open
#3,273 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Intro

Hi,

I am using the MuJoCo Unity plugin to test MJCF import workflows in Unity. While importing sample MuJoCo models into a fresh Unity 6 Universal 3D / URP project, I noticed that the imported materials initially render magenta until Unity's Render Pipeline Converter is used to upgrade the materials.

### My setup

- MuJoCo version: 3.8.1
- Unity plugin source: `unity/package.json` from the MuJoCo repository at tag `3.8.1`
- Unity version: 6000.3.10f1 LTS
- Unity template: Universal 3D
- Render pipeline: URP / SRP
- OS: Windows
- Architecture: x86_64
- Native MuJoCo package: `mujoco-3.8.1-windows-x86_64.zip`

### What's happening? What did you expect?

When importing MJCF models into a fresh Unity Universal 3D / URP project, the generated/imported materials render magenta.

This appears to happen because the imported materials are not compatible with the active render pipeline. Running Unity's Render Pipeline Converter with Material Upgrade fixes the rendering, after which the same imported model displays normally.

Actual behavior:
- The MJCF model imports successfully.
- The model appears in the scene.
- The imported materials render magenta in a URP project.

Image

Expected behavior:
- Imported materials should use a shader compatible with the active render pipeline, or the importer/docs should clearly mention that URP users need to run Unity's material converter after import.

Workaround:
- Open `Window > Rendering > Render Pipeline Converter`
- Select `Built-in to URP`
- Run `Material Upgrade`
- The imported materials render correctly afterward.

Image

Image

### Steps for reproduction

1. Create a new Unity project using the `Universal 3D` template.
2. Add the MuJoCo Unity package from `unity/package.json`.
3. Import an MJCF model using `Assets > Import MuJoCo Scene`.
- I reproduced this with `model/humanoid/humanoid.xml`.
- I also saw the same behavior with `model/balloons/balloons.xml`.
4. Observe the imported model in the scene.

The model imports successfully, but its materials render magenta until they are upgraded through Unity's Render Pipeline Converter.

### Minimal model for reproduction

This reproduces with existing sample models in the MuJoCo repository:

- `model/humanoid/humanoid.xml`
- `model/balloons/balloons.xml`

No custom model is required.

### Code required for reproduction

No code is required. This reproduces through the Unity editor import flow:

1. `Assets > Import MuJoCo Scene`
2. Select `model/humanoid/humanoid.xml`
3. Observe the imported model in a Universal 3D / URP project

### Confirmations

- [x] I searched the [latest documentation](https://mujoco.readthedocs.io/en/latest/overview.html) thoroughly before posting.
- [x] I searched previous [Issues](https://github.com/google-deepmind/mujoco/issues) and [Discussions](https://github.com/google-deepmind/mujoco/discussions), I am certain this has not been raised before.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.