Policy: MINMEM
The "MINMEM" policy is the weapon of last resort. The nuke: the one you want to use when you want to save any possible bit of memory (at cost of a longer pre-processing).
It is defined by:
Code: Select all
scene.images.resizepolicy.type = MINMEM
scene.images.resizepolicy.scale = 1.0
scene.images.resizepolicy.minsize = 64
1) load all image maps at "scene.images.resizepolicy.minsize";
2) compute each optimal image map resolution (i.e. the optimal is when an image map pixel cover one screen pixel);
3) reload each image map and scale to the optimal resolution (where optimal resolution can be forced up and down by "scene.images.resizepolicy.minsize").
This is reference rendering (all the image maps are 512x512):
Using:
Code: Select all
[LuxRays][0.524] [Device GeForce RTX 2070 SUPER CUDAIntersect] ImageMaps buffer size: 5376Kbytes
Using:
Code: Select all
[LuxRays][1.160] [Device GeForce RTX 2070 SUPER CUDAIntersect] ImageMaps buffer size: 4099Kbytes
The log show what MINMEM does:
Code: Select all
[LuxCore][0.593] Resize policy preprocess thread count: 24
[SDL][0.855] Image maps "scenes/randomizedtiling/pattern-3.jpg" optimal resize: 512x512 => 533x533
[SDL][0.855] Image maps "scenes/randomizedtiling/pattern-7.jpg" optimal resize: 512x512 => 266x266
[SDL][0.855] Image maps "scenes/randomizedtiling/pattern-9.jpg" optimal resize: 512x512 => 133x133
[SDL][0.855] WARNING: image maps "scenes/randomizedtiling/pattern-3.jpg" too small !
[SDL][0.855] Reading texture map: scenes/randomizedtiling/pattern-3.jpg
[SDL][0.880] Image maps "scenes/randomizedtiling/pattern-3.jpg" scaled: 512x512 => 512x512
[SDL][0.880] Reading texture map: scenes/randomizedtiling/pattern-7.jpg
[SDL][0.942] Image maps "scenes/randomizedtiling/pattern-7.jpg" scaled: 512x512 => 266x266
[SDL][0.942] Reading texture map: scenes/randomizedtiling/pattern-9.jpg
[SDL][0.998] Image maps "scenes/randomizedtiling/pattern-9.jpg" scaled: 512x512 => 133x133
[SDL][0.998] Applying resize policy MINMEM time: 0.4secs
Now let's render with the same scene at a lower resolution (960x540 instead of 1920x1080):
MINMEM uses even less ram thanks to the lower rendering resolution:
Code: Select all
[LuxRays][0.923] [Device GeForce RTX 2070 SUPER CUDAIntersect] ImageMaps buffer size: 3343Kbytes
Code: Select all
[LuxCore][0.652] Resize policy preprocess thread count: 24
[SDL][0.726] Image maps "scenes/randomizedtiling/pattern-3.jpg" optimal resize: 512x512 => 266x266
[SDL][0.726] Image maps "scenes/randomizedtiling/pattern-7.jpg" optimal resize: 512x512 => 133x133
[SDL][0.726] Image maps "scenes/randomizedtiling/pattern-9.jpg" optimal resize: 512x512 => 66x66
[SDL][0.726] Reading texture map: scenes/randomizedtiling/pattern-3.jpg
[SDL][0.793] Image maps "scenes/randomizedtiling/pattern-3.jpg" scaled: 512x512 => 266x266
[SDL][0.793] Reading texture map: scenes/randomizedtiling/pattern-7.jpg
[SDL][0.852] Image maps "scenes/randomizedtiling/pattern-7.jpg" scaled: 512x512 => 133x133
[SDL][0.852] Reading texture map: scenes/randomizedtiling/pattern-9.jpg
[SDL][0.907] Image maps "scenes/randomizedtiling/pattern-9.jpg" scaled: 512x512 => 66x66
[SDL][0.907] Applying resize policy MINMEM time: 0.3secs
It uses even less ram because the optimal size of the middle quad is even smaller:
Code: Select all
[LuxCore][0.625] Resize policy preprocess thread count: 24
[SDL][0.702] Image maps "scenes/randomizedtiling/pattern-3.jpg" optimal resize: 512x512 => 266x266
[SDL][0.702] Image maps "scenes/randomizedtiling/pattern-7.jpg" optimal resize: 512x512 => 71x71
[SDL][0.702] Image maps "scenes/randomizedtiling/pattern-9.jpg" optimal resize: 512x512 => 66x66
[SDL][0.702] Reading texture map: scenes/randomizedtiling/pattern-3.jpg
[SDL][0.776] Image maps "scenes/randomizedtiling/pattern-3.jpg" scaled: 512x512 => 266x266
[SDL][0.776] Reading texture map: scenes/randomizedtiling/pattern-7.jpg
[SDL][0.843] Image maps "scenes/randomizedtiling/pattern-7.jpg" scaled: 512x512 => 71x71
[SDL][0.843] Reading texture map: scenes/randomizedtiling/pattern-9.jpg
[SDL][0.901] Image maps "scenes/randomizedtiling/pattern-9.jpg" scaled: 512x512 => 66x66
[SDL][0.901] Applying resize policy MINMEM time: 0.3secs
A real world test
This is a rendering of HallBench scene:
And this is the same rendering with MINMEM:
The saved memory is:
Code: Select all
[SDL][34.015] Memory required for original Image maps: 272710Kbytes
[SDL][34.015] Memory required for MINMEM Image maps: 46985Kbytes
More to come
The next strategy will use Arnold .tx files as cache and mip map levels (instead of 100% optimal size) to have about the same memory saving but at no pre-processing cost.