5
$\begingroup$

I import a Video in the image node of the material, can I set the video in reverse? Is there any trick that can do it? Obviously the blender timeline must always go forward.

I have not found any questions like this on the internet, I have lost a few hours of searching, but I have not found anything about it

$\endgroup$
9
+50
$\begingroup$

In order to get more control about the playback of an Image Sequence or Movie Clip, you can set the Frame property of the Image Texture node to the 'first frame' which allows to set the the 'current frame' based on the Offset property.


If you'd like to reverse the playback of a Movie Clip or Image Sequence, you can add a driver expression to the Offset property, eg. #3-frame -> last frame - current frame:

enter image description here


For the sake of completeness: You can also loop the playback by using the remainder a.k.a. modulo operator %, eg. #(3-frame) % 3 -> (last frame - current frame) % last frame:

enter image description here Demo using an Image Sequence (left) and a Movie Clip (right) on the default cube

Note: You can even add a condition to eg. be on the safe side for the 0th frame when cyclic is disabled: #1 if frame==0 else (3-frame) % 3 -> (a if condition else b).

$\endgroup$
4
  • 1
    $\begingroup$ Very very very interesting, I think this is noteworthy. I hope it is as useful to many people as it has been to me $\endgroup$
    – Noob Cat
    Apr 9 '21 at 11:31
  • $\begingroup$ Possibly worth mentioning too modulus' partner in crime div a // b can be used for slow / fast motion. $\endgroup$
    – batFINGER
    Apr 9 '21 at 13:00
  • $\begingroup$ Floor division? Good idea @batFINGER, I just need to get my test files out of the trash can :D $\endgroup$
    – brockmann
    Apr 9 '21 at 13:30
  • 2
    $\begingroup$ Brilliant ... What a hack :) Thanks!!! @NoobCat if answer solved your issue consider mark answer as accepted blender.stackexchange.com/tour $\endgroup$
    – vklidu
    Apr 9 '21 at 22:45
3
$\begingroup$

to do it cyclic you can use this script:

import bpy


# define a driver function
def driver_func(frame, maxframe):
    
    a = maxframe
    
    while a - frame < 0:
        a = a + maxframe
        
    return a - frame

# assign to the driver namespace

bpy.app.driver_namespace["bdriver"] = driver_func

and then use this script as driver:

enter image description here

Run the script once to make it work.

Explanation:

63 is the maxframe (in my case, adapt it to your needs)

The script is pretty "silly", it just gives back maxframe - frame. Before this it checks whether this subtraction would be positive. if not, it just adds the maxframe again until it is positive.

That's all. Have fun!

$\endgroup$
1
$\begingroup$

The following isn't as nice as using a driver, and it's not very precise but as long as you want the image sequence to start playing backwards from frame 1 of your animation, it kinda works:

Go to frame 1, keyframe the offset to the sequence's length minus one, then go to the frame where the sequence would have finished playing and keyframe the offset to the inverse of that.

For example, with an Image Sequence of 250 images:

  • Frame 1: Insert key for Offset = 249
  • Frame 250: Insert key for Offset = -249

To loop it, enable Cyclic, open a Graph Editor tab and add a Cycle Modifier to the Offset curve. Then go one frame past the last key (in my example: 251) and press I to add a key. Without that extra key the loop gets slowly out of sync.

Note: like I said, it's a bit rough, not frame-exact and sometime for some reason you might have to set the second offset to frame length - 2 for it to work. When using that trick in the compositor (second offset to 0) it's a lot more reliable and easier to work with the graph to change the speed.

$\endgroup$
3
  • 1
    $\begingroup$ Consider using a linear generator blender.stackexchange.com/questions/134519/… $\endgroup$
    – batFINGER
    Apr 14 '21 at 3:53
  • $\begingroup$ Right, the "imprecision" is because the curve gives float values when frame number are integers? Gonna try to make it work with a generator and update my answer if I do, cheers $\endgroup$
    – wilks
    Apr 14 '21 at 10:08
  • $\begingroup$ Yes that is what I think is happening. Could make a step curve, but if the generator does it probably quicker. $\endgroup$
    – batFINGER
    Apr 14 '21 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.