For VPB materials, use Pixyz custom materials. To create custom shaders, use material properties.


Before you can import assets with VPB materials, you must perform these tasks:

  1. Enable custom material setup functionality.
  2. Create a custom material setup, that is, map information between imported materials and Unity materials.
  3. Add this setup to default import settings.


Materials are converted using this class: Pixyz.ImportSDK.MaterialConversions. The ConvertCustomMaterial function is called to convert custom materials.

Enable custom material setup functionality

Follow these steps:

  1. From the API, enable the ImportRealisticMaterials preference:

Plugin4UnityProduct.API.Core.SetModuleProperty("IO", "ImportRealisticMaterials", "True")

  1. Modify the Menu.cs file as follows. This file is located in this folder: packages/Pixyz Commons/Editor/UI.
    1. Add the Conversion namespace:

using UnityEngine.PixyzCommons.Conversion;

    1. Remove the comment characters (//) for the CreateCustomMaterialSetupAsset function:

//[MenuItem("Pixyz/Create Custom Material Setup", false, 9)]

//[MenuItem("Assets/Create/Pixyz/Custom Material Setup", priority = 1)]

//private static void CreateCustomMaterialSetupAsset()

//{

//    EditorExtensions.CreateAsset<CustomMaterialSetup>("CustomMaterialSetup", true);

//}


This example shows the first lines of the file after modification:

using System.Text;

using UnityEditor.PixyzCommons.Extensions;

using UnityEngine;

using UnityEngine.PixyzCommons.Conversion;

using UnityEngine.PixyzCommons.Licensing;


namespace UnityEditor.PixyzCommons.UI

{

    internal static class Menus

    {

        [MenuItem("Pixyz/Create Custom Material Setup", false, 9)]

        [MenuItem("Assets/Create/Pixyz/Custom Material Setup", priority = 1)]

        private static void CreateCustomMaterialSetupAsset()

        {

            EditorExtensions.CreateAsset<CustomMaterialSetup>("CustomMaterialSetup", true);

        }

Create a custom material setup

Before you can import custom materials, you must map information between imported materials and Unity materials. Follow these steps:

  1. From the Pixyz menu, choose Create Custom Material Setup.
  2. Map material names:
    1. On the Inspector pane, click the Plus sign (+) in the Custom Material Setup section.
    2. Enter the name of the imported material, for example UMetallicPaintMaterial, then click Validate.
    3. Enter the name of the Unity material, for example Shader Graphs/CarPaint.
  3. Map property names:
    1. Expand the Properties section and click Add property binding.
    2. Enter the property name of the imported material, for example flakeColor, then click Validate.
    3. In the Keyword field, enter the property name of the Unity material, for example ColorCF7B3627.

Select a custom material setup for import

To use a custom material setup for import, follow these steps:

  1. In your project assets, expand Pixyz > Editor and select Default Import Settings.
  2. On the Inspector pane, switch to the debug mode. To do this, click the More Items (⋮) button and select Debug. Read more.
  3. In the list of import settings, click the Plus sign (+) next to the Custom Material Setup field and select a custom material setup.


This illustration shows an Aviera model that has been imported using the Pixyz Plugin: