Load 3D models from CGTrader into mixed reality controls (preview)

[This article is pre-release documentation and is subject to change.]

Important

This is a preview feature.

Preview features aren’t meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.

Want to build apps with mixed-reality 3D content without having to create your own 3D models? Use the CGTrader connector to import 3D content from CGTrader into your canvas apps. CGTrader offers a library of thousands of free and premium 3D models. Browse and load models inside your app, and then use them with the 3D object and View in MR controls.

The connector provides a no-code replacement for working with the CGTrader API. Using actions, apps send requests to the CGTrader API and fetch model data. For more information, see the Connectors overview.

Prerequisites

Request an API key (OAuth client ID and client secret) at https://www.cgtrader.com/developers. Be sure to store your API key in a secure location.

Create a CGTrader connection

You'll need to create a CGTrader connection in Power Apps after you receive your API key. In this example, we'll create a connection on the Power Apps home page. You can also create a connection when you're editing an app in Power Apps Studio.

Tip

A connection is an instance of a connector. You can create multiple connections with different configurations.

  1. Sign in to Power Apps.

  2. In the navigation bar, select Data > Connections > New connection.

    A screenshot of the Power Apps data connections window.

  3. Search for and select CGTrader (preview).

    A screenshot of the Power Apps connections search result with CGTrader selected.

  4. Enter the Client ID and Client Secret you received from CGTrader.

    A screenshot of the CGTrader connector account window.

A CGTrader connection is now listed on the Connections page.

Add a CGTrader connection to your canvas app

  1. Edit or create a canvas app.

  2. In the navigation bar, select Data > Add data. Search for and select CGTrader.

    A screenshot of the Microsoft Power Apps Studio data source panel, with a search for CGTrader shown.

  3. Select the connection you created earlier.

Load CGTrader models directly into 3D object or View in MR controls

  1. Find and select a model on the CGTrader website.

  2. Note the supported file types and Model ID.

    A screenshot of the file types and Model ID of a 3D object on CGTrader.com.

  3. In Power Apps Studio, add a 3D object or View in MR control to the app screen.

  4. Set the control's Source property to CGTrader.GetModel(model_id, "file_type"), where model_id is the ID of the model you selected, and file_type is one of the supported file types.

    A screenshot of a 3D object control under construction in Microsoft Power Apps Studio, shown with its Source property set to a CGTrader model.

Connector actions

The following table lists the most common CGTrader connector actions and examples. For a list of all connector actions, their parameters, and return types, see the CGTrader connector reference.

Action Description Example
GetModel Downloads a 3D object with the given Model ID and file type. CGTrader.GetModel(model_id, "file_type")
GetModelInfo Gets information about a 3D object with the given Model ID. CGTrader.GetModelInfo(model_id)
SearchModels Searches for models from CGTrader based on the given filters. Consider binding this action to the items in a gallery. CGTrader.SearchModels({keywords:"keywords",extensions:"file_types"}).Models
GetCategories Gets available category names and Model IDs. CGTrader.GetCategories()

See also