Matt Belshaw is a British self-taught game developer and digital artist.
’Ello Mate! I’m Matt Belshaw, in this second of a two-part tutorial we’ll Import our character into Unity, use the Auto-import tool to process our clothing, animations, wrinkles and physics and then use the animator and cinemachine to start our cut-scene. (See PART 1)
Thanks to the work of Victor Soupday it’s now easier than ever to use realistic humans and animations created in CC4 and iClone 8 within Unity projects. Because Unity is well optimized and very customizable, being able to leverage the powerful Reallusion tools in synergy with Unity is a huge leap forward in being able to create stunning and diverse games and visuals without needing years of training or a vast budget. If you followed along with the previous tutorial, you have everything you need to follow along with this one. If you haven’t done so already, now is the time to download the Auto Setup addon >> Download Here.
Creating our Project
With Unity hub open, create a new project and ensure that you select 3D (HDRP) as your core type. Set your project name and folder and then click on the Create project button. After a few moments the Unity editor will open.
Installing the Auto-import tool
Click in the Window>Package Manager menu item and the package manager interface will open.
Click on the + dropdown menu in the top left corner and select Add Package from Disk and in the file selector menu, open your downloaded auto-import tool files which your downloaded earlier.
Note that nothing will change in your editor initially. Once you’ve installed the package, you need to save your project and restart the unity editor.
Once it’s been restarted you will see a new Reallusion menu option available on the top bar of the Unity Editor.
Importing our Character
Before we import our character let’s create a separate folder in which to store them. In the Project pane, right click on the assets folder and create>folder and name your new directory.
If you want to keep all your characters in separate folders, you can of course create sub-folders.
It’s time to go back to wherever you saved the exported character files from the previous tutorial.
Copy all the contents from your original export into your Newly created sub-folder within your Unity Project. You should have 4 items to copy, the .json, .fbx, a textures folder and a .fbm folder.
After a few moments your files will be added to your Unity Project.
Now the files are within our project, click in the new Reallusion menu item and select Import Characters
This will open the Unity auto-import window as shown below.
There are many options here but so long as we select the right options in our initial import, we shouldn’t need to use any of the extra functions. For the purposes of this tutorial, we’ll use the following options in our drop-down menus
- High Quality Materials
- Refractive Eyes
- Two Pass Hair
- Bake Custom Shaders
- Bake Separate Prefab
Once you have these selected, Hit the Build Materials button. This will take a minute or so, and when it’s completed Unity will automatically open the file location of the new prefab with the Project browser.
We’re now ready to start animating!
Sorting our animations
In the previous tutorial, we applied all our animations to the iClone timeline in a sequence. We now need to unpack that sequence back into separate animations.
Drag your prefab into the scene and you’ll see that it looks identical to the way it did in Character Creator.
Now navigate back to the original character file which you imported into Unity (as opposed to the prefab)
Within this folder you will see a new icon
This icon represents the animation controller for our new character but just to make sure it’s assigned correctly, drag the animation controller onto the character in the scene window.
Now if we double click on the animation controller, the Animator window will open, showing us the current assigned behaviours for our character when the scene starts.
In the Project pane, select the character file and note that the Inspector window changes. At the top there should be four options, Model, Rig, Animation and Materials. Select Animation.
In the upper half of the Inspector, we can now see our current Clips. There should be one 0_T-pose clip and a *_TempMotion Clip.
As you select each clip note that the preview window at the bottom of the tab reflects the starting frame for that clip.
With the TempMotion clip selected, you can preview the sequence of animations that the character currently has.
Depending on how many animations you added, you will need to repeat the following process for each one.
In the Clips section, select the “+” icon to create a new empty clip and assign it a name that will allow you to recognise which animation it contains.
Now using either the time sliders or entering the frame numbers in the Start and End boxes isolate a single animation from the entire frame sequence.
Don’t forget to check Loop Time if your animation loops.
Note that each Clip you create, adds a new animation to the Character within the Project Pane.
Applying the Animations
Once you have separated out all of the animations, now it’s time to add them to the animation controller.
Reopen the Animator screen by double-clicking the animation controller within the Project Pane.
One of your clips might have been automatically added, but drag the remainder of the new clip files into the animator window.
You can now delete the TempMotion box from this window. It should be the orange box connected to the green Entry box by an arrow.
The green Entry box represents the moment that the character enters the scene.
We can now plot the animations we want to be played from this point onward by right clicking the Entry box and adding a transition to our first animation, you’ll see an arrow line connecting to the animation, now right click that first animation and create a transition to the next and so on until we have a daisy-chain representing our animation sequence.
For this demonstration I’ve kept it simple with just one animation, but there is nothing to prevent your from stringing together as many as you want. Just remember that if one of the animations has “Loop time” checked, it will continue to loop and not move on to the next animation in the sequence.
Moving the Camera
To animate our camera, we’re going to use the Cinemachine package. Re-open the Package manager from the Window menu.
Make sure that the Packages: Unity Registry option is selected from the second drop-down menu.
In the search bar start typing Cinemachine and once You’ve located it, download and import the package to your project.
Save your project and re-start the editor to make sure all new options are available.
We’re going to use Cinemachine Virtual cameras to tell our scene camera where to be at any given time.
In order to do this we need to add a timeline to our project.
In the Project Hierarchy, right click and add a new Empty Game object and name it “Timeline” or something similar which will tell you what the object is for.
Next we need to open the Timeline window which is located in the top menu under Window>Sequencing.
With our “Timeline” Game object selected in the project Hierarchy, click on the Create button within the timeline window.
You’ll now see that the Timeline window looks a little more like what you would imagine an animation timeline to look like.
Now we’ll create a camera which will be used for our animation, by right-clicking within the Hierarchy tab and Create>Camera
Now it’s time to put our camera in the initial position. Navigate to the position that you want your first camera position. Basically line-up the shot as if the scene window were going to be what the viewer sees.
Making sure that you have the new Camera selected within the Hierarchy tab, press CTRL + Shift + F to align that camera with your viewport.
With the Camera still selected, right-click in the Hierarchy pane once more and select Cinemachine>Virtual Camera
This will add a virtual camera at the exact same position as our Camera. We can now move our scene camera and the Virtual Camera will remain in place as a marker.
You can learn more about using Cinemachine to create more exciting shots, as it’s a powerful cinematic tool. For this demonstration I’ll keep it simple with static shots.
Continue lining up shots, using CTRL+Shift+F to move the Camera and then adding a Virtual camera at that position until you are happy that you have enough camera angles to work with.
Putting it together
The last piece of the puzzle is to move the virtual cameras onto our timeline and deciding how long we will remain at each shot and in what order we want to change between them. Make sure the timeline window is open and visible.
Drag your first Virtual Camera into the Timeline window and choose between the two options. For this demo we will create a simple Control Track
You will now see that your virtual camera has been added to the timeline and we can now see at which frame we move to this camera position and for how long. You can change these properties by moving the box along the timeline and dragging the edge of the camera’s timeline box to adjust the duration.
From here it’s a simple matter of dragging all your virtual cameras into this control track and deciding what order you want to play the shots in and for how long.
If you place two adjacent camera boxes touching in the timeline, the camera will do a short sweep from one shot to the next.
If you leave a small gap, the Camera will Jump to the next shot instantly instead.
By pressing the Play button in the Timeline window, you will see the Camera move from each assigned position. This is a good way of checking your sequence but the characters within the scene will not animate.
Now to preview our animation all we need to do is hit the main “Play” button in the Unity interface.
At which point our Game window will play our animations and camera movements in their entirety.
From this point it’s a case of tweaking your camera positions, moving your characters and props to make better shots, and applying your post processing volumes to get the desired look and effects. Experiment with different settings until you get something awesome and don’t forget to tag #Reallusion when you upload your projects so that we can see your amazing creations!
Follow Matt Belshaw:
YouTube: Game Developer Training