Class MaterialImporter | USD | 2.0.0-exp.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class MaterialImporter

    A collection of methods used for importing USD Material data into Unity.

    Inheritance
    Object
    MaterialImporter
    Namespace: Unity.Formats.USD
    Syntax
    public static class MaterialImporter

    Fields

    OnResolveTexture

    A callback that allows custom texture resolution logic.

    Declaration
    public static MaterialImporter.TextureResolver OnResolveTexture
    Field Value
    Type Description
    MaterialImporter.TextureResolver
    Remarks

    Note that this method is only called when texture import is enabled. If this event is wired up, it must return a value, returning null will cause the texture to be skipped. The same texture may be resolved multiple times as needed.

    Methods

    BuildMaterial(Scene, String, MaterialSample, SceneImportOptions)

    Builds a Unity Material from the given USD material sample.

    Declaration
    public static Material BuildMaterial(Scene scene, string materialPath, MaterialSample sample, SceneImportOptions options)
    Parameters
    Type Name Description
    Scene scene
    String materialPath
    MaterialSample sample
    SceneImportOptions options
    Returns
    Type Description
    Material

    CombineRoughness(Texture2D, Texture2D, String)

    Copies the roughness texture into the alpha channel fo the rgb texture, inverting it to convert roughness into gloss.

    Declaration
    public static Texture2D CombineRoughness(Texture2D rgbTex, Texture2D roughnessTex, string fileNameSuffix)
    Parameters
    Type Name Description
    Texture2D rgbTex
    Texture2D roughnessTex
    String fileNameSuffix
    Returns
    Type Description
    Texture2D

    GetSurfaceShaderPrim(Scene, String)

    Reads and returns the UsdPreviewSurface data for the prim at the given path, if present.

    Declaration
    public static UnityPreviewSurfaceSample GetSurfaceShaderPrim(Scene scene, string primPath)
    Parameters
    Type Name Description
    Scene scene

    The USD scene object.

    String primPath

    The path to the object in the USD scene.

    Returns
    Type Description
    UnityPreviewSurfaceSample

    A PreviewSurfaceSample if found, otherwise null.

    ImportConnectedTexture<T>(Scene, Connectable<T>, Boolean, SceneImportOptions, out String)

    Declaration
    public static Texture2D ImportConnectedTexture<T>(Scene scene, Connectable<T> connection, bool isNormalMap, SceneImportOptions options, out string uvPrimvar)
    Parameters
    Type Name Description
    Scene scene
    Connectable<T> connection
    Boolean isNormalMap
    SceneImportOptions options
    String uvPrimvar
    Returns
    Type Description
    Texture2D
    Type Parameters
    Name Description
    T

    ProcessMaterialBindings(Scene, SceneImportOptions)

    Computes the bound material using UsdShade's inherited binding logic. If a material is bound, the request callback is executed to enable the caller to bind the material to the Unity geometry.

    Declaration
    public static void ProcessMaterialBindings(Scene scene, SceneImportOptions importOptions)
    Parameters
    Type Name Description
    Scene scene
    SceneImportOptions importOptions
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023