Page MenuHome

BVH cache files not handled properly
Closed, InvalidPublic


Blender Version

Short description of error
Currently blender saves bvh cache files - generated when Cycles has Cache BVH enabled - to a folder called cache that is located at the same location as the config folder containing startup.blend.

Ideally blender should save temporary cache files to the location defined by the environment variable $TMP or it's default equivalent. For a saved blend file, creating the cache folder to be located in the same folder as the blend file could also be acceptable.

An option to specify the location could be an improvement, either in the Performance panel or within the File section of User Preferences. Another possibility is to define another environment variable that the user can set to specify the cache location.

Event Timeline

Shane Ambler (sambler) raised the priority of this task from to 90.
Shane Ambler (sambler) updated the task description. (Show Details)
Shane Ambler (sambler) edited a custom field.
Bastien Montagne (mont29) lowered the priority of this task from 90 to Normal.May 14 2014, 12:50 PM

I don't really consider this is a bug, rather more like a design discusion. Would let @Brecht Van Lommel (brecht) to decide.

Brecht Van Lommel (brecht) changed the task status from Unknown Status to Unknown Status.May 14 2014, 1:12 PM

It was done this way by design, the purpose was to allow caching BVHs when rendering an animation in the background or rerendering interactively, while at the same time not taking up too much disk space.

Saving it next to the .blend would give you many cache files, and saving it in the temporary folder is not correct when the file needs to be reused between different Blender runs.

Further, this feature will likely be removed when we optimize BVH building more.

@Brecht Van Lommel (brecht): Thanks for stepping in! I also don't see this as an error.
For your info: Consumption of disk space was exactly the problem that prompted this request over on blender.stackexchange (see But maybe the real issue there is why the cache was taking up so much space in the first place?

My original request also was not to put the cache next to the blend file but simply to be able to specify a location at all in case the default location is inconvenient...

Probably of note is that "Cache BVH" sounds like an option that many people will just turn on without knowing or looking into when it offers a benefit. I'd say that a majority of animations won't benefit from it so there will be many users that end up with a cache file for every frame of every animation they have rendered.

With the cache files tucked away in a location that many users don't look at means they end up with a lot of stale cache files that won't be re-used. This also includes cache files from previous versions. Looking into this I found I still had cache files left over as far back as 2.64

I really think the fact that the cache is not deleted nor temporary is a very poor design choice. There are two very big reasons for this.

  1. There is no indication in Blender that the BVH is stored perpetually
  2. There is no clear cache button like there is for other cache (bake) solutions in Blender.

I literally just cleaned 94 Gigs of data off of my disk from several versions of Blender in my applications support folder (OS X). I couldn't figure out why I was suddenly losing around 45 Gigs of space. When I ran Disk Inventory X, I was stunned that that much was nothing but caches.

This needs to be changed or updated to let people know.

IMO, if there is no intention to specify a render output different to tmp, I don't think there is intention to store bvh cache.

It should be at same location as render output instead of preferences location.

This seems to be a big issue with my workflow.

My C drive fills up with BVH cache files when I batch render overnight. I've got a big dedicated cache drive just for this purpose, but I can't get Blender to use it.

It is a bit vague definition around "can't get Blender to use it". Cached BVH only helps for static objects.

If you feel like there's a bug somewhere please submit a separate report.

I understand that there are technical reasons to store BVH cache in a specific location, but is it possible at least to make clearing the cashe doable from within Blender UI? TBH, adding it as an option sounds reasonable and more functional than just burrying it in a specific mandatory folder where many users don't know about, keep wondering what's consuming my hard drive space? There could be a warning that changing BVH cache folder might affect other operations. Or otherwise a reminder note that BVH cache is stored in location X on your hard drive.
Thank you.

This was closed and is no longer relevant. From 2.77 there is no bvh disk cache used.

See rBdfadf18659fc62 and rB97a3fa17d6bb9