
Learn to create animations in Blender with Python by automating keyframe creation. Collect, sort, and feed information to a script that drives Blender elements and verifies results.
Obtain motion data for keyframe animation from accessible sources such as photographs and videos, identifying limb positions over time manually or automatically using Python and Blender.
Explore keyframe animation concepts by defining key poses, setting frames, and letting software interpolate intermediate frames to create smooth motion from positions, size, and rotation.
Explore keyframe animation workflows using Krita for manual pose data, TensorflowJS with PoseNet for automated poses, and Blender with optional VS Code scripting.
Create a simple Krita animation of an arm flexing, mark keyframes, adjust interpolation on the timeline, and export the resulting data to a JSON file.
Import animation frames into Krita to load a sequence of arm flexing images, set the end frame to 24, and preview the looping animation.
Create a simple Krita animation using imported frames as references for arm movement, applying group and paint layers with a transform mask and animation curves to add frames for Blender.
Copy the x, y, and z values from each frame and save them to a JSON file as objects with x, y, z and frame to recreate animation in Blender.
Explore the rest of the animation by examining elbow and shoulder joints and tracking wrist positions over time, then copy the location data into json files.
Learn to write Blender Python code that reads json data, creates two arm bones, and interprets Krita data in Blender, solving axis and proportion differences.
Read json data with python and blender's bpy to create objects. Load json files, store data in wrist_data, elbow_data, shoulder_data, and set frame1_wrist, frame1_elbow, frame1_shoulder from the first elements.
Obtain bpy references, create an armature and its object, then enter edit mode to add two connected bones: shoulder to elbow and elbow to wrist, using head, tail, and parent.
Execute the Python script in Blender, paste the code, press play; the arm appears oversized due to Krita values as far away points, and you will shrink the bones.
Adjust bone size and position to fit the Blender scene, add animation elements, assign inverse kinematics to bones, and create keyframes to capture bone positions over time.
Adjust krita data to scale bone sizes and import mathutils to perform 3D vector operations in Blender.
Execute code changes to refine the arm rig in a keyframe animation workflow using Python and Blender. Observe the arm with smaller bones and a corrected position, validating the update.
Explore inverse kinematics to control bone positions in pose mode by creating shoulder_to_elbow and elbow_to_wrist control bones, wiring IK constraints, and visualizing pose_bones versus edit_bones.
Execute the changes in Blender by adding an armature with inverse kinematics and verify the controller bones in pose mode.
build an ik-driven keyframe system in pose mode by calculating displacement from base to new positions with axis directions, then update bone location and insert keyframes for elbow and wrist.
Execute code changes to create and animate the arm using keyframe animation in Blender with Python, view the keyframes, and adjust animation duration to end as the arm finishes flexing.
Explore installing Tensorflow examples and using a pre-trained model to detect human body limb positions, saving poses to JSON and exposing data via Chrome development console.
Explore how a TensorFlow detector visualizes poses in videos from an art doll to a real person, and apply background color, lighting, and angle tips to improve detection.
Installs the Tensorflow PoseNet examples by downloading tfjs-models, unzipping, navigating to pose-detection demos upload_video, clearing caches, and running yarn watch to launch and train on first run.
Modify the pose detection example to capture 2D and 3D keypoints by updating camera.js with mykeypoints and mykeypoint3d, and enable debugging in index.js via runFrames to inspect poses.
Open the app in Chrome, load a video with the figure, and use BlazePose to detect poses; pause at the debugger to copy mykeypoints3D from camera into a JSON file.
View the JSON file content and see that the positions obtained from TensorFlow reside in an array with many elements.
Re-create the code to read information from Tensorflow, then build an armature with human skeleton-like proportions and adjust the data for compatibility with the Blender scene.
Develop a Blender Python workflow to load json data from TensorFlow, compute neck, torso, and center hip references from shoulder coordinates, using bpy, json, and data filtering.
Use Python in Blender to create an armature and center bones, linking torso to neck and torso to hip, and assign their parent to maintain distance when the parent moves.
Organize Tensorflow data into a usable structure by building source_poses, iterating over data with for loops, and collecting pose dictionaries with x y z coordinates.
Create bones for an armature using a custom function in Blender with Python, defining create_bone to set tail, parent, and use_connect on edit_bones.
Create the left and right arms and legs by using create_bone to connect bones from the neck to the shoulder, elbow, wrist, hip, knee, and ankle, then exit edit mode.
Add the missing name property to objects inside [source_pose], enabling access to information in the [create_bone] function.
Run the script in Blender to produce an armature with a human bone structure. Adjust its position so the armature stands in the next videos.
Move code fragment to the script start, swap y and z in the for loop, invert the z, and move first_frame_pose to the top while replacing list and filter usage.
Execute the changes in Blender to adjust the armature, observe it standing with a slight tilt, and expect future videos to resolve this behavior.
Continue adjusting the armature and use inverse kinematics to place bones and insert keyframes. Tensorflow provides per-frame position data, complicating interpolation and causing shaking that will be addressed later.
Create the controller bone for armature control with inverse kinematics by implementing create_controller_bone, which takes edit_bones, a bone name, and a position, and offsets tail by -0.5 in y.
Create a for loop to step through objects inside edit_bones, call the create_controller_bone function, and pass the data from the bone we are referencing within the loop.
Develop a custom set_ik_to_bone function to apply inverse kinematics to armature bones, using pose_bones data, the controller bone, the bone to be controlled, and configure target, subtarget, and chain.
Create the variable pose_bones referencing myobject.pose.bones to access bones in pose mode, loop through them, discard _control bones, and call set_ik_to_bone with the bone, its controlling name, and 1.
Create position keyframes in Blender with Python by computing bone displacement using mathutils, composing the new position from axis-aligned components, and inserting the keyframe with keyframe_insert.
Enter pose mode and configure frame_skip, then loop through source_poses to insert keyframes for bones excluding _control using base_position and adjusted_position, exiting pose mode at the end.
Run the code in Blender to produce the animated armature and review keyframes; adjust the duration to end at last frame, noting neck and hip controller bones have no values.
Animate the center by calculating neck, torso, and hip positions for each frame through a new for loop over source_poses, inserting these as new elements. Use first_frame_pose to fix bones.
Execute the changes in Blender to assign keyframes to the center bones and observe them moving in the animation.
Create an armature in Blender and assign a model to it, then reuse this setup in later sections to demonstrate the final result.
Create an armature and build a bone-based base structure by using edit mode, x mirror, and extrusions to form the torso, neck, shoulders, arms, and lower body.
Align the armature by standardizing bone names to match TensorFlow points, and assign Python identifiers to the central body bones that TensorFlow does not provide.
Assign the armature to the model, adapt each bone to fit limb joints, and use edit mode to adjust tail bone positions beside the armature for keyframe animation in blender.
Select the model and the armature, press ctrl p to open options, choose armature deform with automatic weights, and automatically assign bone influences to the vertices.
Adjust the code to use a scene armature and adapt Tensorflow data to match armature dimensions, enabling animations with pre-existing models of different sizes.
Assign the armature name from the scene and retrieve the corresponding object using bpy.data.objects, then access the object's edit_bones via myobject.data.edit_bones, and remove the armature creation code.
Run the code in Blender to apply controller bones and keyframes to the armature, then verify the result and address keyframe positions not matching armature dimensions.
Adapt animation data by recalibrating torso-to-neck positions for a new armature, using a for loop over source poses, computing a normalized direction vector, and updating new positions accordingly.
Extend the previous step by adding a fix_position function to recalculate each position in source_poses, adapting neck and torso references, then call it in the loop and save new_positions.
Correct keyframe positions for the left shoulder, elbow, and wrist, right arm, then fix the hip, knee, and ankle using the torso-hip reference, overwriting poses with a for loop.
Get the original pose by extracting the initial armature position in the scene, replacing first_frame_pose with an empty dictionary, and looping through edit_bones to assign first_frame_pos from each bone.
Execute the code changes in Blender and observe the resulting animation. Ensure the animation works with the dimensions of the armature in the scene.
Adjust the code to add body rotation to keyframes, refine keyframe insertion for better control, and use Blender interpolation to reduce model shaking in animation.
Define get_angle to compute the angle between two points relative to an origin, using numpy, V1, V2, unit vectors, cross and dot products, arctan2, and degrees, then convert to Euler.
Correct the parameters passed to the get_angle function and swap the positions of points to refine angle calculations in keyframe animation with Python and Blender.
Create get_distance and rotate_data_from_origin to adjust vectors around an origin, apply an Euler -15 X rotation to fix tilt in TensorFlow data across source_positions.
Implement a rotation keyframe function in Python for Blender, mirroring the position keyframe workflow, using rotation_mode XYZ and Euler angles for the torso_to_neck bone.
Modify the keyframe insertion loop to exclude frames via interpolation, renaming frame_skip to frame_jump, and use index modulo frame to insert frames when the remainder is zero.
Hello and welcome.
If you are a designer or developer who is interested in create pose-to-pose animations in a 3D environment with the possibilities to automate the process, this course is for you.
This course focuses on creating multiple Python scripts that will help us to read pose information from external sources like pictures and video and use it to create an animated armature.
For this, we will mainly use Blender as the 3D Editor and Python to create the scripts.
With Python, we will read JSON files that contains information about the positions of the limbs and time marks that can help us to identify keyframes.
With Blender, we will run the script to create an armature with an animation that recreate the poses from the original source.
We will also use Krita and Tensorflow to get the pose information that we will be using through the course.
You may like this course because it can help you save time when you want to create 3D animations.
In addition, you will have access to the content created during the course.
I hope you find the content useful and that you can apply it to your personal projects.
Have fun and happy learning.
In this course you will learn:
Basic concepts about keyframe animations like keyframes and interpolation
Create a basic animation in Krita to then export the animation data to a json file
Use Tensorflow JS with PoseNet to read the poses of a human body from a multimedia file
Create a Python script that reads the pose data to create animated armature to recreate the source material.
Execute the script in the scripting section provided by Blender
You will require:
You must be familiar with scripting; however, anyone can follow it as each step is explained.
Blender v 3 and above
Visual Studio Code. This is optional since Blender provide his own editor
Krita 5
Pre-trained TensorFlow JS models