In the quest to make the process of rendering more appealing and help artists get better, faster renders, we are launching the guest post series on the RenderStreet blog.
NPR (Freestyle) is a feature that gets more and more attention from the Blender users. We invited Bong Wee Kwong aka Light BWK – who is a NPR pro – to write about optimising Freestyle and explain it all to pieces.
Overview
Freestyle is an awesome post process line art renderer. With Freestyle lines drawing alone, you can make a lot of cool artworks. If you have been following the twitter tag #b3d the past few months, you’ll notice many cool artworks are done with it. Freestyle is available for Blender Internal and (good news) will be available in Cycles for the next release, Blender 2.72. In essence, Freestyle is its own renderer, meaning it has its own way of handling line rendering.
Here is the overview of what Freestyle does when you press F12. First, Freestyle loads the mesh in view into RAM (each frame), creates a view map from selected edge types, then stylize the selected lines. In reality the processes for Freestyle to render lines is more than that, but for this article I think it is best to just show the simplified version.
There are 3 major bottlenecks where Freestyle can slow your render:
- View map options
- Line selection (Freestyle line set panel)
- Line style (chaining and geometry modifiers)
If you are a careful observer, you’ll notice that the 3 items listed above are almost every part of freestyle. Fear not! I’m here to help you.
Mesh Distribution & Poly count
Freestyle line drawing is view dependent, hence every frame needs to be calculated. To optimize scenes from bottlenecking, separate meshes to different render layers. The logic behind that is, for each render layer, Freestyle will create a data called view map. The less geometry that the view map sees means faster for it to be calculated as RAM usage increases with more geometry. Let’s say in the scene you have 4 characters, you can split them up to 2 render layers, then add render layer masking to solve the overlapping problem.
A mesh with less poly count will render faster. This means, while modeling, you have to pay attention to your poly count. Keeping Ngons on flat surfaces may not be a bad idea. For organic models, such as a character, how close and big the mesh on-screen will determine your poly count. A Freestyle optimized mesh will render way faster than an unoptimized version that may look the same when rendered.
Freestyle and advanced compositing video:
Edge types
The next bottleneck is edge types. Edge types are located in the line set panel. For optimal render time, fewer edge types are always faster. Yet there are a few edge type that are heavy to calculate.
There are:
- Crease with high crease angle
- Suggestive Contour
- Ridge and Valley
Being able to understand what lines are being drawn by which edge type will help you in the process. Please see their tooltips for clues of what they do. FYI: Tooltips have been updated for Blender 2.71 by suggestion from the BNPR team and discussion on BNPR facebook group.
View Map options
If you play with view map advance option (Freestyle panel), any non-default value may increase your render time. Keeping these value as default is the best.
Face smoothness is heavy and very accurate, unless absolutely needed (fixing broken lines), it is the best to avoid turning on that option.
Line Chaining
Line chaining is in the Linestyle panel, under the stroke sub-tab. There you can join or split lines. This tab used to kill Blender and may crash your OS (done that many times), but the problem has been fixed after few bug reports. That does not mean stroke chaining will not slow line rendering. If you just want dashed lines, use the dashed line setting. You can use the 6 values in splitting, but that will split the stroke chaining into parts, where each part is a line by itself. More lines equal more RAM, which means slower render. Sketchy chaining will draw lines multiple times, fewer rounds means faster render too.
Geometry modifiers
Geometry modifiers sub-tab in line style is the gem of Freestyle. The available modifiers give you the freedom to add many screen space manipulations to your lines. That freedom also means you can easily abuse it. All the noise category modifiers and bezier curve are heavy when more than one are stacked together. Lowered values for the sampling modifier can also increase render time (but not by much). Unless it is absolutely needed, keeping sampling at 10 is the best for common use cases.
More tips & tricks
There are many more tips and tricks to lower Freestyle render times, but without showing lengthy examples with the background stories, the optimization will be partially understood. There is help. To understand how to optimize Freestyle render time, one must understand Freestyle as a whole. Freestyle Level Up is the answer. Once you understand Freestyle like the back of your palm, you’ll optimize your scenes like a pro. Freestyle is 90% modeling and 10% Freestyle setting. Learning Freestyle is like killing 2 birds with 1 stone. That is, learning Freestyle will upgrade your modeling skills as all senior artists will tell you.
Play with all Freestyle settings. Experiment, explore and have fun with it. Once you understand how freestyle works, you’ll get many “AHA” moments where you’ll find ways to optimize Freestyle for the best render time.
Bong Wee Kwong (Light BWK) is from Malaysia, a co-founder of BlenderNPR.org, a website dedicated to non-photorealistic rendering. He also co-authored the Freestyle course, Freestyle Level Up. He writes screenplays, does 3D set layout and planning. His blog has many NPR tutorials and examples.