S&box Wiki

Revision Difference

Animations_without_Animgraph#545795

<cat>Dev.Model</cat> <title>Animations without Animgraph</title> # Introduction Animgraph is really powerful, but it currently has a bit of a performance bottleneck with many units on screen. Facepunch's own RTS gamemode ran into this issue. Similarly, the tool can be pretty complex and way beyond your needs. You can choose to forego the Animgraph altogether and do all your animation stuff within ModelDoc. This approach is similar to Source 1, except you're doing all your work through a GUI instead of editing a .QC file by hand. # Example compositing ⤶ ## Adding a weapon pose onto anything⤶ Here's what we can do with just a small handful of animations: * Idle * IdleLayer_Breathe (a loop of some subtle motions) * Walk_N (no weapons) * Run_N (no weapons) * Walk_N (walkcycle, no weapons) * Run_N (runcycle, no weapons) * Idle_Sniper (weapon pose) We're going to assume that all of these are already imported as their own sequences. ⤶ We want to be able to generate a Walk and a Run that composites our weapon pose on top. First, we're going to generate duplicates of the movement sequences. We're gonna name them *Walk_Sniper* & *Run_Sniper*. Then, we're going to duplicate our *Idle_Sniper* sequence, and name it *Pose_Sniper*. We'll apply a WeightList to this sequence, and we'll also tick the "WorldSpace" setting. ⤶ The WeightList will define how much the bones fade into each other, and the "WorldSpace" setting (also named "Model Space" in Animgraph) makes it so that the mixing of those bones happens relative to the root of the model space, instead of relative to each bone. ⤶ Our goal: we want to be able to generate a Walk and a Run that composites our weapon pose on top. First, we're going to generate duplicates of the movement sequences. We're gonna name them *Walk_Sniper* & *Run_Sniper*. ⤶ Then, we're going to duplicate our *Idle_Sniper* sequence, and name it *Pose_Sniper*. ⤶ We'll apply a WeightList to this *Pose_Sniper* sequence, and we'll also tick the "WorldSpace" setting. ⤶ The WeightList will define how much the bones fade into each other, and the "WorldSpace" setting (also named "Model Space" in Animgraph) makes it so that the mixing of those bones happens relative to the root of the model space, instead of relative to each bone. Because we're not gonna be using IK here, the arms (including the shoulders) need to be 100%. We also can't be using the pelvis, this is strictly upper body.⤶ ⤶ ![Weightlist](https://files.facepunch.com/maxlebled/1b3111b1/sbox_2021-08-31_19-46-53.png)⤶ ⤶ And now, we're done with our *Pose_Sniper* sequence, so we're going to add it as a layer on top of our *Walk_Sniper* & *Run_Sniper* sequences! Here's a video that shows all this.⤶ ⤶ ## Making the run look a bit nicer⤶ ⤶ This looks pretty nice as-is, but it's looking a little stiff. We should try to add a bit of weapon sway back in... and the way we're gonna do that is by duplicating *Run_N*, subtracting it by itself (to make a delta sequence). Then we apply a WeightList to that sequence which only leaves the spine, neck and head bones in, weakened (10% at spine_0, slowly increasing towards 40% at the head).⤶ ⤶ Then all we have to do is add that delta sequence as a layer on top of our Run_Sniper animation... and we have some nice weapon sway!⤶ ⤶ ![Video](https://files.facepunch.com/maxlebled/1b3111b1/dasp_run_layer.webm)