# How to reverse particle Cache in Blender 2.79

I'm hoping to somehow reverse a baked particle cache (that took ages to bake, based off of a smoke sim). My goal to run the simulation forward at a fixed camera angle, and at the end of the simulation move the camera around the particle simulation as it plays in reverse. Is this possible? I'm using metaballs as particle objects, don't know if that makes a difference.

• Render the frames and play them backwards. – user1853 Feb 7 '18 at 4:54

It's possible (although likely not advisable - but I found quite interesting) to manipulate the actual blendcache files to change the order - although you should avoid points where particles are created or destroyed (ie, stick to sections where particles are only moving) or you can get strange results (eg, particles staying in place when they should have died or jumping erratically to new locations).

Start by giving the cache a name and set it to be a Disk Cache.

Baking the cache should now output a number of 'bphys' cache files - one for each frame (or sub-frame). For example :

myparticlecache_000000_00.bphys


Each of these files contains the state of the particle system at a point in the animation. By manipulating these files - swapping them, for example - you can manipulate the sequence.

For example, if you had, say 72 frames (0 to 71) and reversed the sequence by renaming frame 000000 to 000071, 000001 to 000070, 000002 to 000069, etc., ..., 000071 to 000000 then the behavior would be reversed.

In Unix bash shell you could achieve this with a script similar to the following :

mkdir reversed

ls -1 *_[0-9][0-9][0-9][0-9][0-9][0-9]_*|cut -d'_' -f2 > _ordered
ls -1 *_[0-9][0-9][0-9][0-9][0-9][0-9]_*|cut -d'_' -f2 |sort -nr > _reversed

paste _ordered _reversed > _combined

cat _combined |sed 's/^$$[^ ]*$$    $$.*$$\$/cp myparticlecache_\1_00.bphys reversed\/myparticlecache_\2_00.bphys/' >reverse.scr


This will produce a script (reverse.scr) to perform the 'copy's as follows :

cp myparticlecache_000000_00.bphys reversed/myparticlecache_000071_00.bphys
cp myparticlecache_000001_00.bphys reversed/myparticlecache_000070_00.bphys
cp myparticlecache_000002_00.bphys reversed/myparticlecache_000069_00.bphys
cp myparticlecache_000003_00.bphys reversed/myparticlecache_000068_00.bphys
cp myparticlecache_000004_00.bphys reversed/myparticlecache_000067_00.bphys
cp myparticlecache_000005_00.bphys reversed/myparticlecache_000066_00.bphys
cp myparticlecache_000006_00.bphys reversed/myparticlecache_000065_00.bphys
....


Running the script and copying the files back from the 'reversed' directory over the original bphys cache files, restarting Blender and playing the animation in Blender should now produce a reversed particle animation (albeit with potential glitches at the start and end when particles are created/destroyed).

Note : The above scripting is specific to 'bash' shell - you'll need to come up with another method of renaming the files depending on your environment (eg, Windows batch file, python, whatever).

Also note : manipulating the cache files in such a coarse manner is purely at your own risk. While it won't break anything important (and you can always delete the cache files and re-bake) it might mess up your animation and produce unpredictable results.

• and I don't use Unix and I've already cached 500 frames so this renaming gag is going to take a while ;-b Thanks, I will comment when I have a result! – molly Feb 7 '18 at 22:45

As mentioned by cegaton, it's probably better to have a render with time going forward from both point of views. Camera movement is probably keyframed or following a path so you may have to modify the dope sheet to have a stationary camera when re-rendering at destination. Then add the forward animation into the video editor, then the meant-to-be backward and for the latter, click reverse in the properties.