Skip to content

Animation Settings

hithereai edited this page Jan 7, 2023 · 44 revisions

* A few words about keyframing.
All parameters that end with _schedule can be keyframed - have different values for different frame numbers during the animation.
The syntax is the same for keyframing all of the various schedule parameters. Let's consider the following keyframing values of an imaginary parameter: 0:(0), 1:(1), 5:(5), 10:(10).
At frame 0 we set a value of 0, at frame 1 a value of 1, at frame 5 a value of 5 and at frame 10 a value of 10.
The values between the frames won't stay the same until the next new value, but will instead move linearly towards the next value, frame by frame. So in a param that behaves linearly (e.g strength_schedule) the actual values of the first 11 frames will look like this:
0:(0),1:(1),2:(2),3(3),4:(4),5:(5),6:(6),7:(7),8:(8),9:(9),10:(10)
Prompts and schedules can use MATHs formulas as well. Read more here.

Animation Modes

AnimationModes

  • 2D:
    This mode will attempt to string the images produced in a sequence of coherent outputs. The number of output images to be created is defined by max_frames.
    The motion operators that control 2D mode are as follows: border, angle, zoom, translation_x, translation_y, noise_schedule, contrast_schedule, color_coherence, diffusion_cadence, save_depth_maps.
    Other animation parameters have no effect during 2D mode. resume_from_timestring is available during 2D mode (more details below).
  • 3D:
    This mode will attempt to string the images produced in a sequence of coherent outputs. The number of output images to be created is defined by max_frames. The motion operators that control 3D mode are as follows: border, translation_z, translation_x, translation_y, rotation_3d_x, rotation_3d_y, rotation_3d_z, noise_schedule, contrast_schedule, color_coherence, diffusion_cadence, 3D depth warping, midas_weight, fov, padding_mode, sampling_mode, save_depth_map.
    Other animation parameters have no effect during 3D mode. resume_from_timestring is available during 2D mode (more details below).
  • Video Input:
    When selected, will ignore all motion parameters and attempt to reference a video loaded into the runtime, specified by the video_init_path. Video Input mode will ignore the “none mode” prompts and refer to the prompts that are scheduled with a frame number before them. “Max_frames” is ignored during video_input mode, and instead, follows the number of frames pulled from the video’s length. The notebook will populate images from the video into the selected drive as a string of references to be impacted. The number of frames to be pulled from the video is based on “extract_nth_frame”. Default of 1 will extract every single frame of the video. A value of 2 will skip every other frame. Values of 3 and higher will effectively skip between those frames yielding a shorter batch of images. Currently, video_input mode will ignore all other coherence parameters, and only affect each frame uniquely. Resume_from_timestring is NOT available with Video_Input mode.
  • Interpolation:
    When selected, will ignore all other motion and coherence parameters, and attempt to blend output frames between animation prompts listed with a schedule frame number before them. If interpolate_key_frame mode is checked, the number of output frames will follow your prompt schedule. If unselected, the interpolation mode will follow an even schedule of frames as specified by interpolate_x_frames, regardless of prompt numbering. A default value of 4 will yield four frames of interpolation between prompts.

Animation Parameters

6

  • animation_mode selects the type of animation (see above).
  • max_frames Specifies the number of images to generate in total for 2D and 3D modes only.
  • border controls handling method of pixels to be generated when the image is smaller than the frame. “Wrap” pulls pixels from the opposite edge of the image, while “Replicate” repeats the edge of the pixels, and extends them. Animations with quick motion may yield “lines” where this border function was attempting to populate pixels into the empty space created.

Motion Parameters

  • angle is a 2D (only) operator to rotate the canvas clockwise/ anticlockwise in degrees per frame.
  • zoom is a 2D (only) operator that scales the canvas size, multiplicatively. **For Static/No zoom at all please set zoom=1.0**
  • translation_x is a 2D & 3D operator to move the canvas left/right in pixels per frame.
  • translation_y is a 2D & 3D operator to move the canvas up/down in pixels per frame.
  • translation_z is a 3D (only) operator to move the canvas towards/away from view. [speed is based on fov]
  • rotation_x is a 3D (only) operator to tilt the canvas up/down in degrees per frame.
  • rotation_y is a 3D (only) operator to pan the canvas left/right in degrees per frame.
  • rotation_z is a 3D (only) operator to roll the canvas clockwise/ anticlockwise.
  • flip_2D_perspective when set to True, will enable 2D mode functions to simulate “faux” 3D movement.
  • perspective_flip_theta is used only when flip_2D_perspective is enabled, and controls the "roll" effect angle.
  • perspective_flip_phi is used only when flip_2D_perspective is enabled, and controls the “tilt” effect angle.
  • perspective_flip_gamma is used only when flip_2D_perspective is enabled, and controls the “pan” effect angle.
  • perspective_flip_fv is used only when flip_2D_perspective is enabled, and controls the 2D vanishing point of perspective. Recommended range: 30-160

General Parameters

  • strength_schedule is a global operator that controls how much the presence of the previous frame influences the next frame. Also controls the actual steps per image using the following formula: [steps - (strength_schedule * steps)]
  • contrast_schedule is a global operator that adjusts the overall contrast per frame. [default neutral at 1.0]
  • cfg_scale_schedule is a global operator that controls the Guidance Scale (CFG/ classifier free guidance) for each keyframe. Lower values give SD more space for imagination, while with higher values it will more strictly follow the prompt. Too low of a value and your output won't look like the prompt at all, and too high of a value will look saturated and bizarre. Recommended range: 7-12.5
  • seed_schedule is used only when seed_behavior=schedule, and it sets the seed for each keyframe. Last value will persist until there is a change, unlike most or all other numeric-based schedules. More info coming soon™.

3D FOV (Field Of View) Parameters

  • fov_schedule is in use only when animation_mode=3D, and it adjusts the scale at which a canvas is moved in 3D by the translation_z value. Range is -180 to +180. The value follows the inverse square law of a curve in such a way that 0 FOV is undefined and will produce a blank image output. A FOV of 180 will flatten and place the canvas plane in line with the view, causing no motion in the Z direction. Negative values of FOV will cause the translation_z instructions to invert, moving in an opposite direction to the Z plane, while retaining other normal functions.A value of 30 fov is default whereas a value of 100 would cause transition in the Z direction to be more smooth and slow. Each type of art and context will benefit differently from different FOV values. (ex. “Still-life photo of an apple” will react differently than “A large room with plants”).
  • near_schedule
  • far_schedule

Anti-Blur Parameters

This feature tries to minimize the blurriness that is developing with the animation in some scenarios.
It makes a Gaussian blur of the image and then subtracts it from the source in an attempt to sharpen the image in the process.

  • kernel_schedule is used only when amount_schedule>0, and it controls the dimensions of the matrix on which the distribution is computed.
  • sigma_schedule is used only when amount_schedule>0, and it controls the 'width' of the each blurred pixel.
  • amount_schedule controls how much of the difference (between the gaussian blur version of the img and the actual img) is added back.
  • threshold_schedule is used only when amount_schedule>0, and it sets the minimum difference in pixel values that indicates an edge where sharpen must be applied. So you can protect areas of smooth tonal transition from sharpening, and avoid creation of blemishes in face, sky or water surface.
    * read more/ references: 1, 2, 3
    Video examples: here.

Coherence Parameters

  • reroll_blank_frames controls what happens if/ when deforum encounters a blank or black output image during generation of the animation.
    reroll will try to generate a new image instead of the broken one.
    interrupt will stop the generation mid-run if it encounters a broken frame.
    ignore will ignore the broken frame and continue the run like nothing happened.
  • histogram_matching
  • color_coherence
  • diffusion_cadence

Noise Parameters

  • noise_schedule is a global operator to control the amount of to add per frame for diffusion diversity.
  • noise_type is a global operator to control the type of noise that is applied to the images during the run.
    Perlin is a more natural looking noise. It is heterogeneous and less sharp than uniform noise, this way it is more likely that new details will appear in a more coherent way. It's the new default settings.
    Uniform is the old type of noise that is, well, uniform. Controlled solely by noise_schedule.
  • perlin_w is used only when noise_type=perlin, and it controls the width of the Perlin sample. Lower values will make larger noise regions. Think of it as inverse brush stroke width. The greater this setting, the smaller details it will affect.
  • perlin_h is used only when noise_type=perlin, and it controls the height of the Perlin sample. Lower values will make larger noise regions. Think of it as inverse brush stroke width. The greater this setting, the smaller details it will affect.
  • perlin_octaves is used only when noise_type=perlin, and it control the number of Perlin noise octaves, that is the count of P-noise iterations. Higher values will make the noise more soft and smoke-like, whereas lower values will make it look more organic and spotty. It is limited by 8 octaves as the resulting gain will run out of bounds.
  • perlin_persistence is used only when noise_type=perlin, and it controls how much of noise from each octave is added on each iteration. Higher values will make it more straighter and sharper, while lover values will make it rounder and smoother. It is limited by 1.0 as the resulting gain fill the frame completely with noise.

3D Depth Warping Parameters

  • use_depth_warping is used only in 3D mode. It should be enabled always as without it 3D mode isn't 3D mode. It actually tells Deforum to warp the image dynaimcally using its 3D sub-models (MiDaS and AdaBins).
  • midas_weight is used only when animation_mode=3D and use_depth_warping=true, and it sets a midpoint at which a depthmap is to be drawn. Range: -1 to +1.
  • padding_mode is used only when animation_mode=3D and use_depth_warping=true, and it instructs the handling of pixels outside the field of view as they come into the scene.
    border will attempt to use the edges of the canvas as the pixels to be drawn.
    reflection will attempt to approximate the image and tile/repeat pixels.
    zeros will not add any new pixel information.
    Recommended value: border.
  • sampling_mode is used only when animation_mode=3D and use_depth_warping=true, and it sets the sampling mode.
    bicubic
    bilinear
    nearest.
  • save_depth_maps is used only when animation_mode=3D and use_depth_warping=true, and it sets whether or not to save a greyscale depth-map of each image in addition to the regular output image.

Hybrid Video mode for 2D/3D animations

Please use this guide for now.

  • hybrid_video_generate_inputframes
  • hybrid_video_use_first_frame_as_init_image
  • hybrid_video_motion
  • hybrid_video_flow_method
  • hybrid_video_composite
  • hybrid_video_comp_mask_type
  • hybrid_video_comp_mask_inverse
  • hybrid_video_comp_mask_equalize
  • hybrid_video_comp_mask_auto_contrast
  • hybrid_video_comp_save_extra_frames
  • hybrid_video_use_video_as_mse_image
  • hybrid_video_comp_alpha_schedule
  • hybrid_video_comp_mask_blend_alpha_schedule
  • hybrid_video_comp_mask_contrast_schedule
  • hybrid_video_comp_mask_auto_contrast_cutoff_high_schedule
  • hybrid_video_comp_mask_auto_contrast_cutoff_low_schedule