From BlenderWiki

Jump to: navigation, search

Modifier Cache

Proposal for modifier cache system.

Support common 'mesh-cache' formats as well as providing a general system that blender can use to cache animation.

  • This would be implemented as a modifier which can read and write cache.
  • The modifier would initially support common point-cache formats such as PC2, MDD --- but theres no reason we cant define our own format that stores UV's, MDisps, VColors etc.
  • Existing vertex cache formats depend on vertex order, we can't really avoid this, if the mesh index order changes - the cache needs to be re-generated.
  • The modifiers can both read and write cache, however this would be very clear to the user. since in some cases cache will be generated externally so you wont want to change it.


  • Reading cache, preceding deformation modifiers will be skipped and the cache from the modifier will be used for mesh data.
  • Writing cache would be done with an operator in the modifier UI.
    • We would probably have an operator so you can write cache for all selected objects, as well as another to disable cache from selected objects,... this way could easily select all objects and re-bake their cache.

Files and Paths

When writing cache - the user can avoid having to define a path for every modifier by using a default path (like point-cache)- we could even use point-cache for this. though Id rather not decide on that right now.

Otherwise the user can select the path they want to write to, as with multi-res displacements.

Options

We would want options for start-frame, end-frame, possibly simple transformations such as scaling and XYZ axis flipping... and of course to be able to select the format. Im not too worried about exact options for this modifier, I think it will become clear when writing...

Use Cases

Their are 2 main use cases for this.

1) interoperation with other applications, artists may generate cache in other programs and want to use this in blender, this is quite simple to support, in most cases this will work like having external shape keys loaded from disk but be much more efficient for long animations.

2) to generate cache to be used elsewhere - note blender can already do this using MDD export.

3) for blenders internal use, some operations may be slow and it could be worth using modifier cache to speed them up (I don't think this would happen frequently)

4) in rare cases you might want to export modifier cache to edit and re-import - fixing glitches in animation for example, I don't think this is a good use to encourage but it could be useful in rare cases still.

Further Ideas

  • Frame start/end being fixed could be annoying, we could have the frame as an animated value so you could have total control of what point in time the mesh. This way you can transform the pointcache timing on the dope-sheet too.
  • We may want to embed cache in the file, in this case using the existing point-cache system makes sense.
  • Modifier cache for other data-types could be added, curves for example, not priority.
  • Mixing animations, some kind of NLA to blend in-out different caches, needs more thought since this doesn't fit in so well with modifiers referencing single files... But worth considering if we want to support.