Policy: MIPMAPMEM
MIPMAPMEM image maps resize policy is a trade off between pre-processing speed and memory usage reduction. Instead of using exactly the estimated optimal size of the image, it will use the nearest mip map level size (i.e. for instance, with a 512x512 image, the mip map levels are 512x512, 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4, 2x2, 1x1).
The huge advantage is that the policy uses a .tx file (and creates it if it doesn't already exist or is outdated) with all the mip map levels. So it works like a cache, the mip map levels are created only once and than reused from the existing .tx file avoiding any pre-processing time.
This is the policy to use in every day work. MINMEM instead is the last resort when you are trying to use every single bit of the RAM.
MIPMAPMEM policy is defined by:
Code: Select all
scene.images.resizepolicy.type = MIPMAPMEM
scene.images.resizepolicy.scale = 1.0
scene.images.resizepolicy.minsize = 64
Code: Select all
[SDL][0.001] Creating TX image for file: scenes/randomizedtiling/pattern-3.jpg
[SDL][0.041] Probe ImageMap: scenes/randomizedtiling/pattern-3.jpg.tx [from 512x512 to 64x64]
[SDL][0.041] Reading texture map: scenes/randomizedtiling/pattern-3.jpg.tx
[SDL][0.041] Mip map available: [512x512][256x256][128x128][64x64][32x32][16x16][8x8][4x4][2x2][1x1]
[SDL][0.041] Reading mip map level: 3
[SDL][0.043] Texture definition: 140707101904392Color
[SDL][0.043] Creating TX image for file: scenes/randomizedtiling/pattern-7.jpg
[SDL][0.087] Probe ImageMap: scenes/randomizedtiling/pattern-7.jpg.tx [from 512x512 to 64x64]
[SDL][0.087] Reading texture map: scenes/randomizedtiling/pattern-7.jpg.tx
[SDL][0.087] Mip map available: [512x512][256x256][128x128][64x64][32x32][16x16][8x8][4x4][2x2][1x1]
[SDL][0.087] Reading mip map level: 3
[SDL][0.088] Texture definition: 140707106223624Color
[SDL][0.088] Creating TX image for file: scenes/randomizedtiling/pattern-9.jpg
[SDL][0.134] Probe ImageMap: scenes/randomizedtiling/pattern-9.jpg.tx [from 512x512 to 64x64]
[SDL][0.134] Reading texture map: scenes/randomizedtiling/pattern-9.jpg.tx
[SDL][0.134] Mip map available: [512x512][256x256][128x128][64x64][32x32][16x16][8x8][4x4][2x2][1x1]
[SDL][0.134] Reading mip map level: 3
[...]
[LuxCore][0.506] Optimal image map size preprocess thread count: 24
[SDL][0.816] Image maps "scenes/randomizedtiling/pattern-3.jpg" optimal resize: 512x512 => 533x533
[SDL][0.816] Image maps "scenes/randomizedtiling/pattern-7.jpg" optimal resize: 512x512 => 266x266
[SDL][0.816] Image maps "scenes/randomizedtiling/pattern-9.jpg" optimal resize: 512x512 => 133x133
[SDL][0.816] WARNING: image maps "scenes/randomizedtiling/pattern-3.jpg" too small !
[SDL][0.816] Reading texture map: scenes/randomizedtiling/pattern-3.jpg.tx
[SDL][0.817] Mip map available: [512x512][256x256][128x128][64x64][32x32][16x16][8x8][4x4][2x2][1x1]
[SDL][0.817] Reading mip map level: 0
[SDL][0.838] Image maps "scenes/randomizedtiling/pattern-3.jpg" scaled: 512x512 => 512x512
[SDL][0.838] Reading texture map: scenes/randomizedtiling/pattern-7.jpg.tx
[SDL][0.839] Mip map available: [512x512][256x256][128x128][64x64][32x32][16x16][8x8][4x4][2x2][1x1]
[SDL][0.839] Reading mip map level: 0
[SDL][0.859] Image maps "scenes/randomizedtiling/pattern-7.jpg" scaled: 512x512 => 512x512
[SDL][0.859] Reading texture map: scenes/randomizedtiling/pattern-9.jpg.tx
[SDL][0.860] Mip map available: [512x512][256x256][128x128][64x64][32x32][16x16][8x8][4x4][2x2][1x1]
[SDL][0.860] Reading mip map level: 1
[SDL][0.879] Image maps "scenes/randomizedtiling/pattern-9.jpg" scaled: 512x512 => 256x256
[SDL][0.879] Memory required for original Image maps: 2304Kbytes
[SDL][0.879] Memory required for MIPMAPMEM Image maps: 1728Kbytes
[SDL][0.879] Applying resize policy MIPMAPMEM time: 0.4secs
- Memory required for original Image maps: 2,304Kbytes
- Memory required for MIPMAPMEM Image maps: 1,728Kbytes
- Memory required for MINMEM Image maps: 879Kbytes
A real world test
The results of rendering of HallBench scene with different policies are:
- Memory required for original Image maps: 272,710Kbytes
- Memory required for MIPMAPMEM Image maps: 156,862Kbytes
- Memory required for MINMEM Image maps: 113,532Kbytes
As you see, MIPMAPMEM still deliver a very significative memory usage reduction without most of the pre-processing time cost of MINMEM.
PyLuxCoreTool: MakeTx
There is a new command line PyLuxCoreTool called "MakeTx". It can be used if you want to pre-create the .tx files. For instance if you want to create all the files of a large library of images (instead of having it done on demand). For instance on Linux:
Code: Select all
python3 lib/pyluxcoretools.zip maketx scenes/randomizedtiling/pattern-3.jpg scenes/randomizedtiling/pattern-3.jpg.tx