<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Exploits of Plouj &#187; cli</title>
	<atom:link href="http://www.plouj.com/blog/tag/cli/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.plouj.com/blog</link>
	<description>A blog by Michael Ploujnikov</description>
	<lastBuildDate>Wed, 01 Sep 2010 17:05:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>HOWTO increase Blender&#8217;s memory cache limit for command line renders</title>
		<link>http://www.plouj.com/blog/2009/06/08/howto-increase-blenders-memory-cache-for-command-line-renders/</link>
		<comments>http://www.plouj.com/blog/2009/06/08/howto-increase-blenders-memory-cache-for-command-line-renders/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 03:23:37 +0000</pubDate>
		<dc:creator>plouj</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.plouj.com/blog/?p=308</guid>
		<description><![CDATA[Blender sequencer gives the ability to optimize rendering of repeated frames by keeping the first result in memory cache and re-using it. Depending on the project, it might be necessary to increase this limit beyond the default 32MB. If the limit is surpassed while rendering a single frame, Blender clears the cache before proceeding to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.blender.org/">Blender</a> sequencer gives the ability to optimize rendering of repeated frames by keeping the first result in memory cache and re-using it. Depending on the project, it might be necessary to increase this limit beyond the default 32MB. If the limit is surpassed while rendering a single frame, Blender clears the cache before proceeding to the next frame and the re-renders everything from scratch.</p>
<p>Increasing the cache limit is easy to do in the UI:<br />
<img class="alignnone size-full wp-image-315" title="blender-cache-limit" src="http://www.plouj.com/blog/wp-content/uploads/2009/06/blender-cache-limit.png" alt="blender-cache-limit"/><br />
This setting is stored in the user&#8217;s preference file (<em>~/.B.blend</em> on Linux systems) and, therefore, applies to all projects. However, rendering from the command line requires using the <a href="http://wiki.blender.org/index.php/Doc:Manual/Render/Command_Line_Options">-b argument</a>, which explicitly ignores the user&#8217;s preference file. Apart from editing and re-compiling the Blender source code, I found only one way to increase the memory cache limit.</p>
<p>The trick is to use a Python script, like below, to change the user preferences before rendering the scene:</p>
<pre>import sys
import bpy

def main():
	bpy.config.sequenceMemCacheLimit=4096

if __name__ == '__main__':
	main()</pre>
<p>Add the script to the command line like this:</p>
<pre>./bin/blender -b sample-static-text.blend -P render_settings.py -a</pre>
<p>Note that the order of arguments matters because first we need to load the scene (with <em>-b</em>), then change settings through Pythons (using the <em>-P</em> option) and finally render the animation (with <em>-a</em>). Also, you need at least version <strong>2.49a</strong> of Blender for this to work.</p>
<p>For reference, here&#8217;s is the the source file which hardcodes the 32MB limit:</p>
<p><a href="http://projects.blender.org/plugins/scmsvn/viewcvs.php/branches/blender2.5/blender/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp?annotate=17433&#038;root=bf-blender">intern/memutil/intern/MEM_CacheLimiterC-Api.cpp:</a></p>
<pre>...
static intptr_t &#038; get_max()
{
        static intptr_t m = 32*1024*1024;
        return m;
}
...</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.plouj.com/blog/2009/06/08/howto-increase-blenders-memory-cache-for-command-line-renders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
