# How can I change the directory used to cache BVH?

Is there any way to specify where Blender saves the BVH cache files? It seems that it always goes to a folder inside my user profile (in my case, on Win7: c:\Users\username\AppData\Roaming\Blender Foundation\2.70\cache). I frequently run into system warnings and slow performance because the BVH cache files quickly fill up the available free space on that partition (almost 10 gig). I've got plenty of room on other drives but I cannot find a way to change the cache location...

Is that a bug?

Related: Is caching BVHs also useful for scenes where animated characters are acting in a static environment? The status text at the top of the render view does not indicate that Blender is rebuilding the BVHs for every frame (it only says "Updating BVH for scene" - but this takes far less time than the building for the first frame). So I guess this means it's working as intended but why is it creating upwards of 5 gigs of cache even for relatively simple scenes?

From the blender 2.62 release notes

For renders where only the camera or materials are changing, while meshes stay fixed, it is now possible to skip the sometimes slow BVH step, by enabling BVH Cache in the Performance panel. This will store the BVH on disk for subsequent (animation) renders of the same scene. Note that if the scene does change in the animation, enabling this option will make rendering somewhat slower.

The best way to tell if your mesh is changing is to render a few frames, if you get more than one bvh file in the cache directory then the mesh is changing and cache bvh probably isn't helping. Some simple tests can show that an armature deforming a mesh is considered altering a mesh and creates a new cache file each frame, the same as an object moving in the scene, but a camera moving through a static scene can make use of one cache file.

5GB of cache files sounds extreme, of note here is that blender doesn't appear to clear this cache out by itself, you may want to delete everything in your cache folder.

As for where it is saved, you should be able to delete the cache folder and replace it with a shortcut - be sure to call the shortcut cache. I know this works on *nix systems but should also work on windows.

• Sure, linking would probably work (I believe the correct term on Windows for this scenario would be a "junction point") and if there is no other solution for this, then that is certainly what I will do - but while this may be common practice in the *ix-world, on Windows I would consider this a hack, not a real solution... A Blender setting for this on the File tab in User Preferences would seem far more appropriate... – Oliver Giesen May 13 '14 at 9:45
• For reference I have reported this - see what the devs say. – sambler May 14 '14 at 4:31
• On a side note: I recently tried the junction trick for the cache folder and unfortunately it simply led to Blender crashing on render... :-/ Fortunately, you were right, that I didn't actually need BVH caching for my project... – Oliver Giesen May 19 '14 at 11:27
• For anyone still following this - the cache bvh option has been removed from the performance options - which prevents it from being enabled. The plan is to also remove all code used to save the cache to disk. So from 2.77 there will be no saving of bvh cache to disk. – sambler Oct 25 '15 at 16:28

I have an interesting discovery after using BVH cache for my 8 second render. The first image render took 3:30 minutes and after the first image the rest took under 2:30 minutes every time and never went through 'building bvh'. The funny thing is that I did have a fire simulation going on in the scene and that is why I had 50GB of BVH files! So BVH does work on animations where some of the meshes move and others don't. Oh and I almost forgot I used dynamic BVH and not static BVH. So if what I have figured out is correct you should use this setting if you only have one or two objects moving in your scene and if you have good storage space and it does speed up rendering.