The DiskCache node caches to disk scanlines from its input as they are requested by its output. This can be useful, for example, if:
• you are working on a large, complex node tree. Using the DiskCache node, you can break the node tree into smaller sections and cache any branches that you are no longer working on.
• you are reading in images from a network. If you insert a DiskCache node after a Read node, the image is cached locally and displayed faster.
• you are painting or rotoscoping. If you insert a DiskCache node before a RotoPaint node, flipping frames becomes faster.
The cached images are saved in the same directory as the images the Nuke Viewer caches automatically. You can set the location and size of this directory in the Preferences. For more information, see Defining the Settings for Caching.
NOTE: Even though the DiskCache node and the automatic Viewer caching use the same cache directory, they do not share the same cache files. Therefore, using a DiskCache node does not create cache files for the Viewer and does not necessarily speed up playback. Instead, if placed at strategic, expensive parts of a node tree, it can speed up calculations, as Nuke can reference the cached data rather than recalculate it.
Unlike the images in the Viewer cache, the images created by the DiskCache node affect your rendered output and are always saved as full floating point images.
If you make a change in the nodes upstream, the affected cached images are discarded and automatically recalculated.
NOTE: When executing a script on the command line, the DiskCache nodes are NOT automatically executed.
1. | Set the zoom level in the Viewer. By default, only the lines displayed in the Viewer are cached. |
2. | Select Other > DiskCache to insert a DiskCache node after the last node in the section of the node tree that you want to cache. |
3. | From the channels dropdown menu, select which channels to cache. |
Nuke caches the selected channels of the current frame at the current zoom level. From this point on, Nuke references the cached data instead of constantly recalculating the output of the preceding nodes.
As you pan and zoom around, new parts of the image are cached.
4. | If you want to cache more than the current frame and zoom level, click the Precache button in the DiskCache properties and enter a frame range in the dialog that opens. |
This forces Nuke to cache all frames specified. All lines are cached regardless of what is shown in the Viewer. Where the required images are partly cached already, Nuke only calculates what is missing.