The Cycles_Texture_Cache branch uses a rather sophisticated method for texture caching just like the commercial renderers Iâve been using so far. They convert the textures from all sorts of formats (8-bit, 16-bit, JPEGs, PNGs, TGAs, TIFFs, EXRs, ⌠you name it) to an image format that supports mip-mapping and tiling.
One of the readily available open source tools for this is e.g. maketx from the OIIO library.
Mip-mapping means that after the conversion the image file contains a sequence of scaled down versions of itself. In case of a 2k square texture this means that it also contains these mip-map levels:
2048x2048 1024x1024 512x512 256x256 128x128 64x64 32x32 16x16 8x8 4x4 2x2 1x1
These are accessible without having to load the whole image file. The smaller the texture is in the rendered result (e.g. because itâs farther away from the camera) the smaller the mip-map level thatâs actually loaded can be. This way an 8k texture might only weigh in like a 512px texture and consume a lot less memory.
Tiled images have another advantage: During conversion theyâre split into square âtilesâ that can also be separately accessed by the loader. In the default case of maketx these tiles are 64x64 pixels in size.
If e.g. only a part of a texture is visible in the rendered image, only these tiles need to be loaded and stored in memory.
Mip-mapping and tiling in combination can allow you to render scenes with terabytes of textures on a machine with a lot less RAM. Depending on the implementation of the texture cache, the parts of the textures that are currently in use can be swapped in and out of memory dynamically.
Iâm not a software developer myself but all of this doesnât only sound complicated, it for sure is not a trivial task to build into a renderer properly.
Luxcore or rather its Blender integration BlendLuxCore have added a very clever and neat method for texture scaling thatâs not quite as elaborate as the one just described: Itâs also pre-converting the textures to mip-mapped versions and only loads the needed sizes. It doesnât support tiling or dynamic swapping as far as I know, but it can help a lot in scenes with many and/or big textures.
Hereâs a thread in their forums about this Scene texture maps resize policy - LuxCoreRender Forums
Itâs already ready to test in the latest Alpha builds and works quite well, without the need for the renderer to support all that complex mip-map / tiling stuff.
If I get it right no special changes had to be made to LuxCore (the renderer itself) to support this. Maybe this could be a (preliminary?) solution for Cycles as well.