Exporting 3ds Max Populate Characters to Stingray
In this tutorial, you learn how to export 3ds Max Populate Characters to Stingray, so you can enrich real-time scenes with live animated characters.
- Recorded in: 3ds Max 2017, Stingray 1.4
- This tutorial is intended for use with 3ds Max version 2017 or higher.
00:00:05 --> 00:00:10
It is possible to send animated Populate characters from 3ds Max to Stingray.
00:00:11 --> 00:00:18
The best results involve characters that are animated in place (idle), so that the looped animations are predictable and easy to control.
00:00:19 --> 00:00:21
There are a few things to consider before you start.
00:00:21 --> 00:00:28
First, it is best to process your characters individually and not have them bound to a particular scene.
00:00:28 --> 00:00:37
In this particular example, it is very easy to be influenced by the scene and create a sitting character on the bench or a standing character near the bus stop.
00:00:37 --> 00:00:46
Doing either would create characters that are fairly far from the 0,0,0 origin of the world and that may create issues in Stingray.
00:00:47 --> 00:00:56
Even though a character and its skeleton are self-contained within 3ds Max, in Stingray, an invisible bounding box would make them dependent of the origin point.
00:00:57 --> 00:01:01
This would create issues when manipulating and previewing the character in Stingray.
00:01:01 --> 00:01:08
It is therefore best to start in a blank scene, and then add and place characters in Stingray where you need them.
00:01:09 --> 00:01:16
Creating Populate idling characters in 3ds Max is quite easy and has been covered in many other tutorials on this channel.
00:01:17 --> 00:01:26
You simply use the ribbon and the Populate tab to create idle areas with a simple click and drag, making sure they are close to the center of the world.
00:01:27 --> 00:01:35
Gender identifiers appear in pink and blue colors. Depending on the idle area size, you may get individual characters or groups.
00:01:36 --> 00:01:38
We'll settle for a single character for now.
00:01:39 --> 00:01:44
To generate a character and simulate its motion, you use the Simulate button on the ribbon.
00:01:44 --> 00:01:52
By default, the simulation runs for 300 frames. The longer it is the more taxing it becomes in size and in complexity.
00:01:52 --> 00:01:55
Let's use 100 frames in this example.
00:01:55 --> 00:02:03
Once the character is generated, play back the animation and notice the jump between the last and first frames, as the animation loops.
00:02:04 --> 00:02:09
We'll revisit this problem shortly along with various ways to fix it.
00:02:10 --> 00:02:17
More characters, single or groups can be created similarly but there's also an option to create seated characters.
00:02:18 --> 00:02:25
A reference box makes it easy to place and orient the character, again make sure it is close to the center of the world.
00:02:26 --> 00:02:32
A character's general appearance can be changed using the Regenerate button on the ribbon.
00:02:38 --> 00:02:45
The resolution of the characters is quite low by default; this is by design, in case you want to create a few dozens in your scenes.
00:02:46 --> 00:02:52
However, you have the option to switch to higher resolutions using the appropriately-named button on the ribbon.
00:02:53 --> 00:03:00
The first time you use this tool, you will be prompted to download and install a High-Resolution package in order to use this functionality.
00:03:01 --> 00:03:06
From there, you can toggle between low and high resolution characters with a click of a button.
00:03:08 --> 00:03:16
The geometry becomes more detailed, but it's worth noting that the bitmap associated with the character changes as well.
00:03:17 --> 00:03:26
It switches from a low 256x256-pixel resolution to a far more acceptable 1024x1024-pixel resolution.
00:03:30 --> 00:03:36
Similarly, you can change the character's motion if you're not entirely happy with the one that was generated.
00:03:36 --> 00:03:44
The Resimulate button cycles through a series of random motions and you can choose the one you works best for you.
00:03:48 --> 00:03:54
To export the animated character to Stingray, you first need to bake its animation to its skeleton.
00:03:55 --> 00:04:04
Keep in mind that once you do that, you won't be able to change the animation or even the character's appearance or resolution as you did before.
00:04:04 --> 00:04:12
Once you are ready though, you can bake the animation by selecting the character and using the Bake Selected button on the ribbon.
00:04:12 --> 00:04:18
This makes the character's skeleton visible and you can expand and see its hierarchy in Scene Explorer.
00:04:19 --> 00:04:26
With any given populate character, the topmost parent that contains animation data is the xxxxCOM1 object.
00:04:27 --> 00:04:35
If you were to select that object or any of its children, you'll be able to see the animation keyframes on the timeline.
00:04:36 --> 00:04:45
Again, you can see by playing the animation that the first and last frames show totally different poses, thus creating a jump in the motion.
00:04:46 --> 00:04:49
We'll explore two different ways of dealing with this issue in a moment.
00:04:50 --> 00:04:58
First, you need to export the animated character to Stingray. For that you want to ensure you select all the animated skeleton's nodes.
00:04:58 --> 00:05:08
The easiest way to do that it to select the topmost parent that has animation data (xxxCOM1) and then right-click and choose "Select Child Nodes".
00:05:09 --> 00:05:17
With the Ctrl key pressed, you also want to select the character's geometry in the viewport, as this is ultimately what you will be looking at.
00:05:17 --> 00:05:26
Assuming Stingray is running and a Stingray project open, you can send the selected character using the Stingray menu.
00:05:26 --> 00:05:34
First ensure the Connect option is enabled, and then with the character and its skeleton selected, choose Send Selection.
00:05:35 --> 00:05:41
When prompted, save the file to disk, preferably under your Stingray working project.
00:05:43 --> 00:05:49
When prompted for more options, you mostly want to ensure the Animation and Skeleton option is enabled.
00:05:50 --> 00:05:59
By default the New or Update skeleton is enabled, that's a good thing as you will need this in Stingray to apply an Animation Controller.
00:05:59 --> 00:06:06
The Import Clips option is equally important since you want to use the animation information you're importing from 3ds Max.
00:06:07 --> 00:06:12
The Create Animation Folder is really optional and depends on how you like to organize your files.
00:06:13 --> 00:06:19
You can disable it if you prefer to store the animation file in the same folder as the skeleton and the mesh.
00:06:20 --> 00:06:26
As you see in this example, the scene in Stingray is the same as the one you saw in 3ds Max at the beginning of this movie.
00:06:27 --> 00:06:31
You want to add your character and place it in the scene on the bench.
00:06:31 --> 00:06:37
With Populate characters, my advice would be to verify the culling properties of the geometry.
00:06:37 --> 00:06:46
In some cases, the geometry of the character may pop in and out based on zooms and pans, which makes for a very annoying behavior.
00:06:46 --> 00:06:55
To prevent that from happening, double-click the thumbnail that represents your character's geometry or "Unit", to open the Unit Editor.
00:06:55 --> 00:07:06
There, you can select the mesh of your character and switch the culling value to Disabled. Exit the dialog and save the changes.
00:07:07 --> 00:07:13
Update the changes on the thumbnail. Note that at this point, the character is not animated just yet.
00:07:14 --> 00:07:20
To see the animation you imported from 3ds Max, you first need to add an animation controller to the skeleton.
00:07:20 --> 00:07:24
This can be done with a right-click on the skeleton's thumbnail.
00:07:28 --> 00:07:33
Once you have named and confirmed the creation of the controller, you can double-click it to edit its behavior.
00:07:34 --> 00:07:41
By default, there's an empty clip. Delete it and replace it with the one coming from 3ds Max.
00:07:42 --> 00:07:46
Save the changes to refresh the preview window and analyze the results.
00:07:47 --> 00:07:54
By default, the animation loops and as anticipated, there's a bad jump between the last and first keyframes.
00:07:56 --> 00:08:06
Disable the looping properties and save again. Also as anticipated, this time the animation runs once and then stops.
00:08:07 --> 00:08:15
To induce a loop that you can control, drag the center of the motion clip to the right until you create a transition that loops back to the same clip.
00:08:16 --> 00:08:21
As a condition, you want the transition to happen at the end of the animation itself.
00:08:21 --> 00:08:30
Save the changes again. This time the animation loops and there's a linear transition that happens between the last and first frames.
00:08:31 --> 00:08:39
It is somewhat fast in this case, so change the Blend Duration value to about 1 and try again.
00:08:43 --> 00:08:45
This seems to work much better.
00:08:58 --> 00:09:00
Exit the dialog when done.
00:09:00 --> 00:09:06
All that's left to do is to drag the newly animated character and place it in the scene.
00:09:11 --> 00:09:14
It will show animated in the viewport,
00:09:20 --> 00:09:25
but also at the thumbnail levels of the unit and the animation clip.
00:09:26 --> 00:09:32
The transition worked well here because the character's feet in this particular case were well planted on the ground.
00:09:33 --> 00:09:40
If the position of the feet changes between the last and first frames, then there may be some sliding involved in the transition.
00:09:40 --> 00:09:46
In that case, you may need to do some cleanup work in 3ds Max before exporting to Stingray.
00:09:46 --> 00:09:54
In 3ds Max, consider the lady standing and idling about. Scrub the animation and note the lady's feet.
00:09:55 --> 00:10:00
The position of the feet is quite different between the beginning and the end of the animation.
00:10:00 --> 00:10:06
Use the same process as before to bring this character into Stingray.
00:10:08 --> 00:10:12
You can see a significant slide of the feet as the animation loops.
00:10:12 --> 00:10:21
To prevent this effect from happening, you need to minimize the offset position of the feet between the first and last frames of the animation.
00:10:21 --> 00:10:29
You can do that in 3ds Max with a bit of adjustments to the keyframes, mostly by copying and reversing part of the animation.
00:10:29 --> 00:10:33
This is done by first selecting all the bones that have keyframes.
00:10:35 --> 00:10:40
You also may want to extend the animation temporarily to give yourself some wiggle room.
00:10:41 --> 00:10:48
You also need to enable the Show Selection Range option with a right-click as this will help you manipulate keyframes.
00:10:49 --> 00:10:57
Select all the keyframes on the timeline, and then hold Shift and drag any of them to the right to copy the set.
00:10:58 --> 00:11:05
Next, drag the Selection Range left handle and swipe it to the right to reverse that clip.
00:11:05 --> 00:11:13
Keep an eye on the bottom left corner to keep the scaling at 100% so as not to affect the speed of the animation.
00:11:13 --> 00:11:23
You can then slide the selected keyframes back into position. You can also adjust the beginning, middle and end sections for slower transitions.
00:11:26 --> 00:11:30
If you need to, adjust the total animation length yet again.
00:11:31 --> 00:11:40
All this ensures that the beginning and end keyframes are now exactly the same and playback will result in a seamlessly looping animation.
00:11:41 --> 00:11:46
You can in fact already see this in 3ds Max by playing the animation.
00:11:59 --> 00:12:01
Select all the animated bones,
00:12:07 --> 00:12:09
and the character's geometry,
00:12:11 --> 00:12:13
and send them back to Stingray,
00:12:16 --> 00:12:18
overwriting the existing file.
00:12:23 --> 00:12:29
The data is updated and you now have an idling character with a motion that loops seamlessly.
00:12:31 --> 00:12:37
Once you have an animated character behaving properly, you may ultimately want to use it in another Stingray project.
00:12:37 --> 00:12:46
For that, you can export an "asset" in a package that contains all the relevant information, from geometry to skeleton to animation.
00:12:47 --> 00:12:52
All you need is to right-click the unit's thumbnail and choose Export Assets.
00:12:53 --> 00:13:00
A dialog shows you all the dependencies including animation data as well as materials & textures.
00:13:01 --> 00:13:06
When you export that content, you create a "smart asset" that is stored to disk and self-contained.
00:13:06 --> 00:13:12
All you need to do from that point on is to simply import it and place it into a different project.
00:13:14 --> 00:13:18
You wouldn't need to redo the setup work you did earlier.
00:13:20 --> 00:13:27
This workflow is easy and quite important when sharing your assets between colleagues and clients, or even selling them on-line.