Introduction: How to Animate Floating Objects (In Source Film Maker)

For many animators, implementing realistic physics in a project can be difficult. However, this can be great practice for improving their skills. It incorporates moving both people and objects realistically. This Instructable is a tutorial on how to animate these things in Source Filmmaker, Valve's own 3D animation software. This software is great for introducing beginners to animating, given its simple design. To show how to use it to animate floating objects, I've animated a tourist floating in a pool ring as an example.

Supplies

To make a Source Filmmaker animation of something floating, you need:

  1. Steam + a Steam account
  2. Access to the Source Filmmaker workshop
  3. Source Filmmaker

Step 1: Setting Up the Scene

Before you start animating, you need to get everything in place first. This means finding your floating object (in this case, a pool ring) and, if needed, a character on it (in this case, a tourist-like character). To do this, load the map you want the scene to take place in, and use the "Add" tool to put your models in the scene and their properties to the Animation Set Editor (on the left). It's best to add any accessories, specific clothing, or props to your character, as it will be difficult to add them after animating them. If you are new to Source Film Maker, this is a good time to try using models from the Source Film Maker Workshop. For example, the map for the scene is downloaded from the workshop, which is a hotel-themed beach area, where you can find the link to download it here.

Step 2: Locking the Character to the Floating Object

One of the most important steps of animating a character on a floating object is locking them together. This makes it so that when the object moves in the water, the character on it moves with it rather than staying where you put them. To do this, start by posing your character on the object without locking them together yet. This is done in the motion editor (press F3 to enable it), not the graph editor. This doesn't have to be perfect, just good enough for you to visualize how it would look. Once you do this, select the pelvis bone (bip_pelvis) of the character, and then right-click the root bone of the object (rootTransform) while holding CTRL. Then select "Lock Transforms To 'rootTransforms'". This will now make it so that when the root bone of the object is moved, the character moves along with it. Once this is done, you should finish posing your character as you want them at the beginning of your animation, and place them in the water. Here, I finished posing my tourist based on this reference image to get a realistic pose, and even gave him a drink to hold (which can be downloaded from the workshop here).

Step 3: Basic Buoyancy Principles

To get a realistic floating animation, it's important to know how buoyancy makes things float. Buoyancy is a force created by an object when placed in water, which is directly related to the volume of water displaced by the object, or mathematically (density of liquid)x(volume of liquid displaced)x(acceleration of gravity). Something will float if the force caused by its weight (which is (acceleration of gravity)x(mass)) is less than its buoyant force, as the first pushes it down while the second pushes it up, which can be seen above. While you don't need to do the math to make sure your object floats, it's good to know it so you can get a rough understanding of how easily your object should stay above water, or how it handles when moving. In my example, because a floatie displaces much more water than how much it weighs, it will float well in the water.

Step 4: Basic Floating Movenent

To start animating the movement of your object, open the graph editor (F4). How this tool works is by making a "key" at a certain point, and then posing the selected bone as you wish. Make another key later in the timeline and change the pose to how you want it to be, and then the program will automatically animate the bone moving between those two keys. For this project, we will assume the body of water will have waves, which crash and recede, causing the object to move back and forth. To animate this, start by making one key and then making another while moving the pool ring forward a little bit. Then, go between the keys and make two new ones, where the position of the ring goes down and up, like it's bobbing in the water due to the waves. The ring shouldn't go back to the same spot, but to the side, so the animation is natural. Additionally, the receding of the waves pulls on the ring more than the crashing pushes it, so the keys should be closer at those times to make it move faster. In the image above, each green dot represents a point at which the ring moves. You can see how they are close, showing that the ring moves slowly, calmly, and in correspondence to the waves. In the side-view, you can see how the ring is going up and down to represent the bobbing.

Step 5: First Example of Floating Actions: Drinking

An important aspect to understand when animating a floating object is how shifting its weight impacts its motion. To do this, we can show the tourist sipping his drink. First, I animated him leaning forward to reach his drink. This shifts the center of mass of the system (the ring and the tourist). This causes one side to go deeper in the water than the other, which shifts the center of buoyancy (where the buoyant force is) to the deeper side, causing the pool ring to tip. The diagram visualizes how this works. So, once the center of mass is shifted on your floating object, you should animate its tilt accordingly. In my example, as the tourist shifts the center of mass to sip his drink, the pool ring tilts accordingly.

Step 6: Second Example of Floating Actions: Shark

To show more examples of buoyancy, I animated a shark passing by the tourist in my example. As with the pool ring, learning about how the shark interacts with its own buoyancy force helps you understand how to properly animate it. Sharks can stay underwater because, unlike people, they have very few organs with space. Because air makes the average density of something less than water, a lack of it will allow the shark to easily stay submerged. Additionally, its fins act like wings, where the water gives the shark an upward force of lift so that it doesn't sink to the bottom. Translating this into animation, the shark should not be bobbling up and down like the pool ring while also being able to easily control its depth.

To start animating the shark, I downloaded this model and used the smaller shark. Then, I started animating its movement. Like animating limbs, you start by animating movement for the proximal (closer to the torso) part of the limb and then the distal (further from the torso) part. This means animating the spine_3 bone first, by simply using the graph editor to move it from left to right, copying and pasting the keys to achieve symmetry. Then, I animated spine_4 the same way, making sure the left-to-right motion matches spine_3's motion to make the shark's motion fluid. After doing this, I animated the path of motion by making one key at its initial point, and then the shark's final point where both were out of the camera's field of view (shown by the white lines). Then, I made keys between them, dragging the shark's path into the field of view for each one. When doing this, make sure that the shark's motion isn't a perfect parabolic shape. An imperfect path makes it more natural.

After animating the shark, we need to give the tourist a reaction. I did this by making him sit up in the pool ring and watch the shark swim by. As usual, I animated the proximal parts of his arm and neck first, and then the distal parts. Before animating his head movement, make sure you have the back and forth motion for the pool ring animated for the scene first, as the head movement is just posing it in the direction of the shark, and will look off if the shark isn't where the tourist is looking. The most important part of this motion is animating him sitting up. To do this, start with the closest spine bone to the pelvis, and animate each one moving slightly forward. At the same time, animate the legs so that they rise out of the water (this can be done by just animating the upper leg bone/thigh to curl upwards). An extra detail you can add is changing the facial expression of the tourist by selecting the main model and changing either the core face properties or using the preset sliders. To finalize it, I animated the ring tilting due to the weight shift.

Step 7: Third Example of Floating Actions: Paddling

To end the animation, I animated the tourist paddling out of the water with one hand. To begin this, I animated the tourist turning to the shore. The main bones that are responsible for this movement are the neck, upper spine, and the right collar bone, all of which are animated to turn towards the shore. Next, I animated the distal parts of the arm scooping into the water to paddle. Once you animate the arm going back and forth once, you can just copy and paste the keys for each bone to animate multiple paddles.

After animating the paddling motion, I then made the pool ring move towards the beach. When doing this in your animation, its important to make sure that the movement matches up with the tourist's paddling. This means that when the actual paddle motion is happening, the pool ring should move faster through the water, as that's when the force is the strongest. When it the tourist is moving his hand back for another paddle, the pool ring should move slower. This is because the initial force from the paddle has been dampened by the water resistance. Additionally, you should only animate the ring bobbling up and down during this time, as when the tourist is actively paddling, there is a gliding effect that makes the ring's path smooth. Once you have enough movement for the tourist to paddle off screen, the animation part of the video is done!

Step 8: Adding Water Particles/Effects for the Tourist

One of the most important things to add to your animation of a floating object is special effects, or particles. To start, I did the effects for the tourist. For this animation, I used these particle effects from the workshop. To use them, start by adding them to the session with the add button and selecting "particles". Make sure you are at the exact time for when you want the effect to start. Then, once you have found the file, make sure you select the splash effect you want, and hit "Ok".

For this example, I'm going to animate the water splashing when the tourist paddles, as this is the part where the tourist interacts with the water the most. To do this, I started by adding a water particle effect right when his hand goes under the water. Once you add a particle, you need to refresh the animation by dragging the player (bar that you use to move through the timeline) to the 0-second mark so that it will appear. Next, move the bone "controlPoint0" to the spot where the tourist's hand goes underwater. Then, add another small splash when the hand comes out of the water. Be careful of the timing of when the splashes start, as they should happen after a good portion of the hand submerges and surfaces, as water splashes happen due to the displacement of water.

Step 9: Lighting

For this scene, I used 3-point lighting. This means having 3 lights around the subject, which are the key, fill, and rim light. The key light, represented by the green dot on the image above, is the most important. It can set the mood of the animation, causing either dramatic shadowing or a calm scene by allowing more light to fall on your tourist. This light is the main source of light for the scene, so it's important to get its positioning right. The next light is the fill light, represented by the top white dot. This light is responsible for filling the shadows caused by the key light, and is typically the same color as the key light. It should be a lower intensity (controlled by the slider in its properties) than your key light and placed on the opposite side of the camera, as shown. Finally, the rim light is placed directly behind the tourist, making a halo light effect. While this light isn't really impactful in my example, it is still important to add. For a more in-depth lighting tutorial for Source Filmmaker, please take a look at my other Instructable here. Because our scene is set outside, I made the colors as close to natural sunlight. This is done by controlling the red, green, and blue scales between 0 and 255. Above, you can see the color combination that I used in my example. For intensity, I heavily decreased it from the initial value for the key light, and then slightly less than that for the other two. For positioning, I made the lights more level with the tourist, as the scene does not need very many shadows. To easily move the lights, drag them onto the viewport (the area where you can see everything), which will allow you to easily move them as though they were cameras.

Step 10: Camera Settings

Another important step in finalizing the animation is the camera settings. To edit them, select your camera on the animation set, and go down to the scalar settings. First, I started by matching the focal distance so that the pink wall lines up with your character. Then, I adjusted the tone map scale to match the scene. This setting controls brightness, so I scaled it up from the initial setting. Then, I adjusted the SSAOBias to max, which controls SSAO calculations, dampening unwanted aspects like excessive darkening in shadowed areas. I then turned the SSAOStregnth down and the SSAORadius up, so that there were still some shadows present.


Step 11: Sound Effects

The last step before exporting the animation is adding sound effects. While it's possible to do this in a video editing program, I did it in the Source Filmmaker app. I started by going to the clip editor (F2) and scrolling until I saw the sound section. When right-clicking it, it gives you the option to add a sound clip. When picking that option, you can get access to the Valve sound library, as they made the software. For sounds, I used the water sound effects that came pre-installed with Source Filmmaker. I added ambient ocean noises, and then sound effects for the waves to match the motion of the pool ring, for the shark swimming, and the tourist paddling away.

Step 12: Exporting

Now that I have finished the animation, it's time to export the video. To do this, I started by going into the properties of Source Filmmaker on Steam and entering "nsecure -sfm_resolution 2160 -w 3840 -h 2160 +flex_smooth 0 -sfm_shadowma" into the modifications section, and relaunched the software. I then selected "File>Export>Movie", and used "More Options" to set the frame rate to 30, resolution to 1080p, and turn off motion blur. There are multiple ways to export the video, but I chose to do it as an image sequence because it's the most reliable. This means getting each frame as a PNG, downloading the audio as a WAV file separately, and using FFmeg- a pre-downloaded program on Windows that uses the command terminal that convert an image sequence to an MP4 video. I did this by exporting everything to a folder, opening it in the terminal, and entering this command: "ffmpeg -framerate FPS -start_number START -i PREFIX%0DIGITSd.png -i AUDIOFILE.wav -c:v libx264 -preset slow -crf 17 -pix_fmt yuv420p -c:a aac -b:a 320k -shortest OUTPUT.mp4". For those who want to export as an image sequence, change fps to the framerate you downloaded the video as, START to 0, PREFIX to your session name, DIGITS to how many numbers are in your file name of the PNGs, AUDIOFILE to the name of the WAV file, and OUTPUT to what you want the MP4 to be called. For me, it was "ffmpeg -framerate 30 -start_number 0 -i session551%06d.png -i session551.wav -c:v libx264 -preset slow -crf 17 -pix_fmt yuv420p -c:a aac -b:a 320k -shortest session551_final.mp4". Once the video has been put together after being exported, everything is done!

Step 13: Final Video

Combining physics knowledge, animation skills, lighting techniques, and video editing helped me create this final product!