Exploring the sample scenes

Our Unity SDK provides a fully functional sample scene that creates and/or loads didimos into the active scene and plays life-like animations. For this, you will need to import our Unity Package. Then, you will find sample scenes under "Assets/Didimo/Scenes".

Pre-requisites

  1. Before proceeding, please ensure that you have configured the API Key prefab with an API Key obtained from the Customer Portal.

    alt text

  2. To properly render the didimo with the best visual quality, we have developed our custom HD Scriptable Render Pipeline, which requires compatible shaders. Check your quality settings on the project settings screen and ensure you are using the Didimo Render Pipeline asset included in the SDK.

    alt text

For full setup reference check the Installation & Unity Package Contents


Exploring the sample scene

Loading a didimo consists of updating all of its meshes, binding them to a skeleton, and updating the textures and normal maps.

Then, you can also customize the didimo by adding a hairstyle or changing the eye color. All the predefined hairstyles, hair colors, and iris variations are located in assets folders. Each hairstyle needs to be fitted to the didimo's head shape, by calling an API endpoint that transforms the generic vertex positions to fit the didimo head.

By reading this document, you will learn how to use our sample scene, and how to use our loader for connecting to the Didimo API. Our SDK also contains source code to call our API endpoints.

The sample scene serve as examples on how to load didimos into a running Unity scene. Use the Menu, which has three ways to get a didimo:

  • Generate a Didimo from an image in the file system
  • Generate a Didimo from a photo using the device's camera
  • Load an already generated Didimo from its code

alt text

Creating and loading a didimo

Generate didimo from an image in the file system

Use this option to upload an image from your filesystem, and instantiate the didimo on the scene.

alt text

Generate didimo from camera

Use this option to capture and upload photo using the device's camera (works with webcams), and instantiate the didimo on the scene.

alt text

Load didimo from code

Use this option to instantiate a didimo on the scene, given a didimo key.

alt text

The editor console logs the didimo key when generating one, on the previous steps. You can also use the Didimo Browser, the Customer Portal, or inspect the SDK to list didimos and view each key.

As a quick tool, you can refer to How to view didimo metadata using the Didimo Browser

Playing with the didimo

Change the facial expression

Use the panel toggles to display the expressions panel.

You can change the facial expression according to mood, using the toggles.

alt text

For reference about the facial expressions used in the sample scene, please check the Animations section.

Make it speak

Use the panel toggles to display the speech panel.

You can make the didimo speak by inserting text in the input field, and pressing the play button.

alt text

Play MOCAP animations

Use the panel toggles to display the mocap panel.

Press play on one of the items from the scroller to animate the didimo on the scene.

alt text

For reference about the animations used in the sample scene, please check the Animations section.

Change hairstyle

Use the panel toggles to display the hair panel.

Select a hairstyle from the scroller to apply it to the didimo on the scene.

alt text

Change hair colour

Use the panel toggles to display the hair color panel.

Select a color from the scroller to apply the corresponding material state file to the selected hairstyle.

alt text

Change the iris

Use the panel toggles to display the eyes panel.

Select an iris from the scroller to apply it to the didimo on the scene.

alt text


Scripts used in the sample scene

Inspect the DidimoManagingScripts GameObject in the scene hierarchy to navigate through the scripts used in the sample scene.

alt text

Didimo From Camera

This script is used to capture a photo from the device's camera, if available, and then call the Didimo API to create a didimo, wait for pipeline progress, and then instantiate the didimo on the scene.

Didimo From Image File

This script is used to capture a photo from the device's camera, if available, and then call the Didimo API to create a didimo, wait for pipeline progress, and then instantiate the didimo on the scene.

Didimo From Code

This script is used to capture a photo from the device's camera, if available, and then call the Didimo API to create a didimo, wait for pipeline progress, and then instantiate the didimo on the scene.

Didimo Importer

This script is used to capture a photo from the device's camera, if available, and then call the Didimo API to create a didimo, wait for pipeline progress, and then instantiate the didimo on the scene.

Didimo Menu Handler & Player Toggles Handler

These scripts are used to initialize and manage the sample application menu panels.

Animation Manager

This script is used to initialize and manage the AnimationPlayer in the sample demo scene.

Mocap Gallery

This script is used to initialize and manage the AnimationPlayer in the sample demo scene.

Hairstyles configuration

The Hair Config script is used to initialize the available hairstyles options and to apply it to the active didimo in the sample demo scene.

As shown in the image below, this component holds hairstyles for 2 base headshapes according to template versions (headshape 1: template < 2.0 which is deprecated; and headshape 2: template version >= 2.0). Each hairstyle consists of a prefab to be placed on the didimo's head and a hair cap texture that is applied to the head shader.

NOTE: The deformation method was substantially modified in the newer version of the models and although we have setup a sample that works with legacy didimos and hairstyles, you are only required to configure headshape 2 if you are not working existing didimos.

alt text

The Hair Color Gallery Scroller component, shown in the image below, is used to initialize the available hair colors options, holding material state files describing each color's shader properties, and to apply it to the active didimo's hairstyle in the sample demo scene.

alt text

Eyes Gallery Scroller

This script is used to initialize the available iris textures options and to apply it to the active didimo in the sample demo scene.

Animation Player

This script/component is added to a didimo after instantiation, and is used to play animations through the realtime rig.

Realtime Rig

This script/component is added to a didimo after instantiation, and is used to control the rig.

Shaders used in the sample scene

To properly render the didimo with the best visual quality, we have developed our custom HD Scriptable Render Pipeline, which requires compatible shaders. Check your quality settings on the project settings screen and ensure you are using the Didimo Render Pipeline asset included in the SDK.

alt text

For reference check the Shaders section.

Animations used in the sample scene

For reference check the Animations section.


Multiple templates

Our Unity SDK provides support to multiple templates. You will be able to load didimos, play animations and change hairstyle, using different templates. You can check the didimo's metadata to view these properties and other features, such as if the model supports deformation.


Last updated on 2020-10-06