Freestyle integration into Blender

September 29, 2008

No more environment variable

Filed under: Update — The dev team @ 4:09 PM

As of today, Freestyle runs without having to set the FREESTYLE_BLENDER_DIR environment variable: style modules and data files are now stored in the standard .blender/scripts/freestyle directory. This should allow all of you to compile and use the branch for your own tests.

I also generalized the glBlendEquation function verification to all platforms, not just for the Win32 build. Depending on your card and driver, glBlendEquation might not be supported or might only be accessible through glBlendEquationEXT.

I hope that these changes will make the program more robust and will allow a greater amount of people to use Freestyle. Let me know if you are experiencing problems with the latest revision. I am (finally…) moving on to an essential addition: strokes are going to be rendered by Blender’s internal engine (rather than by OpenGL).


September 25, 2008

Quick update

Filed under: Update — The dev team @ 6:18 PM

I have not taken the time to update the project recently for many reasons and I wish I wasn’t keeping you all so anxious for more features and documentation. The good news is that I should have some free time in the next few days and I intend on getting some work done.

In the mean time, I made two little corrections today. I first incorporated Tamito Kajiyama’s patch, which he says resolves some stability issues on the Win32 build (particularly on older machines). Secondly, I removed the whole paper textures functionality, correcting the weird “hitepaper.jpg” loading misprint. Right now, strokes are rendered on a white background. In the future, strokes will be rendered directly in their own layer (as was intended in the proposal) so you will have complete creative control over the background.

Before working on the layer functionality, I will get the environment variable “issue” resolved once and for all. I will have the style modules and data directly stored in Blender’s standard directories. I do not know how to do that yet but I figure it shouldn’t be too hard.

I will keep you updated in the next few days on the blog.

September 10, 2008

More feedback

Filed under: Questions — The dev team @ 5:05 PM

Before I start answering your questions, I just want to remind you all that Freestyle is currently a development branch that is prone to crashes, memory leaks and all of the worst you can expect from the integration of two very different code bases. I understand your frustration for all of the crashes and the “monochrome” renders, but this is what happens when you use an unstable branch. Use it at your own risk and try to help me fix your situation by sending bug reports. If you expect production-quality execution, I would advise you do not use the branch at all (it will ease some of the frustration I have read on the thread ;) ). Also, note that some of your questions can be answered by reading/searching the blog.

I want to particularily thank Ronin and Jesterking for helping me out answer some of the questions for me. I am impressed by the animation provided by Ronin on the BA thread (demo1 and demo2)

Finally, I don’t know why but none of my posts on the BA thread are listed. I registered 4 days ago. Is that normal to wait for that long for getting moderator approval ?

Let me now go over some of your questions from the BA thread.

Interpretation problem (‘Error executing Python script from PythonInterpreter::interpretFile:’)
For all of you whose style modules are not found, that means you have not set up the FREESTYLE_BLENDER_DIR environment variable correctly (either the path or the path format is wrong). FREESTYLE_BLENDER_DIR should point to the directory where the data and style_modules_blender folders are stored. Examples:
– *nix:  (I set it in ~/.profile)
export FREESTYLE_BLENDER_DIR=/Users/joe/branches/soc-2008-mxcurioni/
– Windows:
set FREESTYLE_BLENDER_DIR=C:\freestyle\befree-win32\.blender\scripts

General problems

– “warning: you may want to set the $home environment variable to use APPNAME. Otherwise, the current directory will be used instead”
this message will be removed. The $HOME directory is not used by Freestyle.

– “glBlendEquation unavailable on this hardware -> switching to strokes basic rendering mode”
from my understanding of the original code, it means your graphics card driver does not support the glBlendEquation function, that is part of the GL_ARB_imaging subset. This problem only seems to show up on Windows and that’s why the original Freestyle authors probably defined two rendering modes (with and without blending).

– “when I drag the renderwindow out the screen,the part of the out screen will be rendered in black. Is it a bug?”
I am not having this problem on my Mac. This is probably related to the OpenGL implementation of your card. It is important to remember that strokes are currently rendered using OpenGL in the render window’s back buffer before being copied to Blender’s internal memory.

yellow’s questions (which were answered by Ronin for the most part)

– Do I have to set the env variable everytime I fire up blender? or as I have done can I set it the usual way?
It doesn’t matter how you set the environment variable, as long as it is available :) BTW, this environment variable is not a “design choice” on my part; that’s how it was set up originally. Like Nathan mentioned, it will be removed altogether in the future (the style modules and the differents data will be copied to the Blender folder).

– Getting a warning about setting $HOME to use APPNAME if I set $FREESTYLE_BLENDER_DIR in the above way, if I remove it the warning changes to ‘you may want to set the $FREESTYLE_BLENDER_DIR to use APPNAME? Does the $HOME warning matter?
Only FREESTYLE_BLENDER_DIR is required for Freestyle execution.

– Do I have to have ‘Freestyle’ selected in the ‘Output’ panel? The tooltip suggests so? Or is it just for style modules that use edge rendering? It’s in the edge rendering part of the Output panel?
To obtain a result, select ‘Freestyle’ from the rendering engine list (among ‘Blender Internal’ and ‘Yafray’). Then a ‘Freestyle’ tab should appear. By default, the full path of the contour style module should appear. You can click the folder icon in that ‘Freestyle’ panel to choose another style.
The ‘Freestyle’ button in the ‘Output’ panel was inserted when I started work on layers. It is currently not used. It will activate the use of Freestyle in render layers (the same way that the ‘Edge’ button was working).

– Does the camera lens value matter ?
The lens value is actually supported. Unfortunately, only perspective projection is supported. Orthographic projection will be supported later.

– Do I have to have the meshes I want rendered selected?
You don’t select the rendered models by hand. Freestyle only uses geometry that is accessible in your render layer. For example, if your scene has models in layers 1 and 2 but you only select layer 1 for your rendering (in the ‘Output’ panel), then the algorithm will only be applied to the models in layer 1 (I hope it was clear enough…).

– Do I have to have the camera selected?

– Do I need a light in the scene?

– Do all the style modules in the Style_Modules_Blender folder work with current implementation?
The currently supported modules are listed on the page I will regroup them on a single blog page soon. I’ll keep you all posted.

Why is there a second modules folder?
For development :) The style modules to use for rendering are stored in the style_modules_blender folder. I use the style_modules folder as a backup of the legacy code, in case my modifications go terribly wrong (I could just delete and get all of the original modules with previous svn revisions, but it’s troublesome in practice to do that).

Would it make sense to avoid confusion if all the modules in the Style_Modules_Blender folder are the only ones known to work?
I never said you could use the style_modules folder :) Please, use the instructions given on the blog.

– I’ve added the /data/textures/papers folder from the freestyle site as blender tells me it can’t find hitepaper.jpg, has that screwed it up? It seems to load the paper but not render it? and I guess thats a typo though it doesn’t matter I guess whitepaper.jpg
This error message has been driving people crazy (me included) for a while but it is nothing important. It is another example of code that made sense when Freestyle was a stand-alone application, but which doesn’t when it is integrated within Blender’s pipeline. It will be simply removed altogether (you’ll set the background yourself as you wish).

– Is it possible to get camera shift working with current implementation?
It is not supported yet and is not at the top of my immediate priorities. Sorry !

September 9, 2008

Freestyle branch (finally) builds on Windows

Filed under: Update — The dev team @ 7:06 PM

Thanks to Nathan Letwory (jesterking), the Win32 build is now a reality ! Nathan and I were able to hunt down the last remaining problems:

  • Freestyle was originally using extgl in its Windows version to determine if glBlendEquation is made available by the graphic card’s driver. Thanks to Apricot, glew was incorporated into Blender a few months ago. I used it to test for glBlendEquation‘s presence.
  • The original SConscript file for the Win32 build was somewhat buggy and would not compile the files in the rendering folder.
  • Custom Python searchpaths provided by Freestyle (used to import style modules) would not be recognized by the Python interpreter due to format inconsistencies (Blender’s file functions would use a single forward slash for directory separators, while Windows require double backslashes). Nathan normalized the paths by adding the ‘r’ prefix to each pathname.

The latest revision (16442) can be used to produce a fully-working Win32 build (do not forget to define the system environment variable FREESTYLE_BLENDER_DIR, containing the full path to the source/blender/freestyle folder). I encourage you all to make a build a share it on graphicall.

Some feedback

Filed under: Other — The dev team @ 2:56 AM

[I originally posted this message on BlenderArtists in the Freestyle thread ( to answer some questions that I found there. It is still waiting for moderator approval so I am putting it here too to make sure you all have this information.]

Hello everybody,
I have followed the thread throughout the summer and have wanted to answer some of your questions for a long time, but couldn’t due to lack of time. Now that I am back at school and  “settled” again, I have more time to communicate on the project. First and foremost, I want to reassure you all that despite the lack of recent progress, I still want to actively develop the remaining features of the original project proposal.

Let me now go over your different questions/remarks:

Win32/Linux 64 build
I have made a call on my blog for Win32 builders but have had no response. If you are interested in having a specialized build, are running the platform yourself and are not too scared to download the branch and compile it, please do let me know by sending me an email at I would work with you to make this build happen.

Crashes with animation
I haven’t myself tested Freestyle in such conditions. I am sure there is still quite a lot of redundacy in the current code and there is much room for improvement and optimization. If you encounter a crash and are able to recover a core dump or crash-related information, please do let me know. I’d be interested to resolve that issue.

strcmp issue
I added “#include <cstring>” to StringUtils.h. Hopefully, it will resolve the problem.

Trunk integration
I can understand that many of you would like to have Freestyle directly integrated in trunk now. Unfortunately, it is not production-ready and would not even pass Blender’s guidelines for release (I haven’t even started talking about trunk integration with the development team). I am sorry that the work cannot be distributed yet but it is better for long-term stability. I coded many parts of the project in a hurry and I would to go over many areas of my code, to clean it up.

User accounts on the blog
Apparently, my WordPress was wrongly configured so email registration was not working all along… I will go over each of the user accounts, manually recreating them and noticing each person by email. After that, I’ll try to configure the blog properly so that registration works. Thank you for your understanding.

I hope I have answered most of your questions. Do not hesitate to share your comments/questions, either on this thread (that I’ll continue to follow) or on my blog.


Blog at