This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

Blender

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
This article is a stub. You can help by expanding it.
Resources

Blender is a professional free and open-source 3D computer graphics software.

Installation

Note
Installation of recent releases of Blender on Gentoo is rather complicated.

This page explains how to solve the most common issues for installation of version 2.78. Blender quickly changes, so these steps may soon become obsolete. Wiki editors will attempt to stay current on build instructions.

If something is broken do not hesitate to make changes to the article.

USE flags

USE flags for media-gfx/blender 3D Creation/Animation/Publishing System

X Add support for X11
alembic Add support for Alembic through media-gfx/alembic.
bullet Enable Bullet (Physics Engine).
collada Add support for Collada interchange format through media-libs/opencollada.
color-management Enable color management via media-libs/opencolorio.
cuda Build cycles renderer with nVidia CUDA support.
cycles Build cycles renderer (requires media-libs/openimageio and dev-libs/boost).
cycles-bin-kernels Precompile the cycles render kernels for the CUDA/HIP/OneAPI backends, if they are enabled, at compile time. This makes it so that the user doesn't have to wait for the kernels to compile when they are used for the first time in Blender. If this option is not on, they will be built as needed at runtime.
dds Adds DDS textures support to Blender.
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
embree Use embree to accelerate certain areas of the Cycles render engine.
experimental Build Experimental Blender Modules
ffmpeg Enable ffmpeg/libav-based audio/video codec support
fftw Use FFTW library for computing Fourier transforms
fluid Adds fluid simulation support via the built-in Mantaflow library.
gmp Add support for dev-libs/gmp (GNU MP library)
gnome Add GNOME support
headless Build without graphical support (renderfarm, server mode only).
hip Build cycles renderer with AMD HIP support.
jack Add support for the JACK Audio Connection Kit
jemalloc Use dev-libs/jemalloc for memory management
jpeg2k Support for JPEG 2000, a wavelet-based image compression format
man Build and install man pages
nanovdb Enable nanoVDB support in Cycles. Uses less memory than regular openVDB when rendering.
ndof Enable NDOF input devices (SpaceNavigator and friends).
nls Add Native Language Support (using gettext - GNU locale utilities)
oidn Enable OpenImageDenoiser Support
oneapi Build OIDN with Intel oneAPI SyCL support
openal Add support for the Open Audio Library
openexr Support for the OpenEXR graphics file format
openimageio Enable OpenImageIO Support
openmp Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp"
openpgl Enable path guiding support in Cycles
opensubdiv Add rendering support form OpenSubdiv from Dreamworks Animation through media-libs/opensubdiv.
openvdb Enable openvdb for volumetric processing, like the voxel remesher. Also enables volumetric GPU preview rendering for Nvidia cards.
optix Add support for NVIDIA's OptiX Raytracing Engine.
osl Add support for OpenShadingLanguage scripting.
otf Install OpenType font versions
pdf Add general support for PDF (Portable Document Format), this replaces the pdflib and cpdflib flags
potrace Add support for converting bitmaps into Grease pencil line using the potrace library.
pugixml Enable PugiXML support (Used for OpenImageIO, Grease Pencil SVG export)
pulseaudio Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire)
renderdoc Build Blender with renderdoc support
sdl Add support for Simple Direct Layer (media library)
sndfile Add support for libsndfile
tbb Use threading building blocks library from dev-cpp/tbb.
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
tiff Add support for the TIFF image format
valgrind Enable annotations for accuracy. May slow down runtime slightly. Safe to use even if not currently using dev-debug/valgrind
vulkan Add support for the experimental Vulkan viewport backend
wayland Enable dev-libs/wayland backend
webp Add support for the WebP image format

There are many additional features that can be enabled via USE flags. See the list above or the Additional Features section below for further details.

FILE /etc/portage/make.confAppropriate Global USE flags for Blender
# All these global USE flags could be specified locally if desired.
# While both ffmpeg and libav currently work, only ffmpeg is officially recommended.
# Cycles requires tiff. Add any additional formats required eg. jpeg png...
# If audio is required, choose from openal, jack or sdl.
USE="ffmpeg X opengl threads tiff openal jack sdl fftw openexr expat"
FILE /etc/portage/package.useAppropriate Local USE flags for Blender
# blender
media-gfx/blender python_single_target_python3_5 cycles boost openexr tiff openimageio player game-engine bullet fftw openal jemalloc opensubdiv openvdb openvdb-compression
# Enable cuda or opencl if possible
media-libs/opencv cuda opencl
media-libs/openimageio opencv
media-libs/opensubdiv cuda opencl ptex tbb

Unmask related packages by adding to /etc/portage/package.keywords:

FILE /etc/portage/package.keywordsAccept unstable Blender related packages
media-gfx/blender ~amd64
sci-libs/ldl ~amd64
# Blender 2.78 requires python 3.5.2 (2.72b runs on the stable python 3.4)
dev-lang/python:3.5
# For cuda support in 2.78 (See below for 2.72b patch)
dev-util/nvidia-cuda-toolkit ~amd64
# For openvdb and openvdb-compression support
dev-libs/c-blosc ~amd64
# Cycles and Open Shader Language require Boost
dev-libs/boost ~amd64
dev-util/boost-build ~amd64

Emerge

Currently, Gentoo package tree provides two versions of Blender:

  • Blender 2.72, requiring Python 3.4, which is no longer enabled by default. Please refer to PYTHON_TARGETS and enabled python 3.4 if you want to install Blender 2.72. Then proceed installing blender:
root #emerge --ask media-gfx/blender
  • Blender 2.79+, requiring Python 3.5+, which is enabled by default. However this version of blender is not marked as stable. Easiest way to unmask it and all required dependencies would be using autounmask write:
root #emerge --ask --autounmask-write --ask ~media-gfx/blender-2.79

Additional Features

This section lists many of the optional features available in blender and gives a brief overview of their use for beginning users.

Audio Device Support

Support for Jack, OpenAL or SDL audio can optionally be enabled through USE flags.

Inside blender, go to the File->User Preferences->System tab and set the Audio Dev to the desired setting.

Cuda Support

Cycles renderer can work on GPUs, for example Nvidia GTX 970 is about twice as fast as an i5 4690k on traditional BMW benchmark. Support for AMD GPUs and opencl is improving.

To enable graphics card rendering, install Cuda:

root #emerge --ask --verbose dev-util/nvidia-cuda-toolkit

With gcc 4.9, Cuda may not work, complaining that it does not support gcc-4.9 and higher. However, gcc 4.9 happily works after a simple dirty hack: in a file /opt/cuda/include/host_config.h

...
#if defined(__GNUC__)

#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)

#error -- unsupported GNU version! gcc 4.9 and up are not supported!

#endif /* __GNUC__> 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) */
...

replace "8" with "9" twice.

Inside blender, go to the File->User Preferences->System tab and set Compute Device to CUDA and select the graphics card in the box below. If the graphics card is not supported these options will not be visible.

Now set the renderer to Cycles Renderer and in the renderer panel under the Render options set the Device to GPU Compute.

The first time a render is created with a new version of blender, the CUDA kernels will need to be compiled. This may take over 15 minutes.

File Format Support

Support OpenCOLLADA (.dae), jpeg2k, sndfile and tiff image file formats can optionally be enabled through USE flags.

The collada USE flag adds entries to File->Import/Export for Collada (Default) (.dae) files. The others can be used with background images in the properties panel of the 3D View or as output formats in the render panel.

Blender should work with either ffmpeg or libav libraries, although only ffmpeg is officially recommended by the blender developers.

Headless (Server Only)

For render farms it is possible to compile blender with the headless USE flag. This is not recommended for most users.

This feature reduces the blender file size by around 5 MB, but it will not be possible to run blender normally as the GUI is not available.

In headless mode, blender can still be used to run python scripts from the commmand line

user $user $ blender -b -P script.py [-- [--optionsforscript .. ] ]
Note
This functionality is also available with regular versions of blender, it is not necessary to enable the headless use flag to run scripts from the command line.

Memory Allocator

It is recommended to enable jemalloc to use a more efficient memory allocator. This reduces wasted memory during rendering and allows for larger scenes to be rendered.

Memory Profiling

Support for memory profiling can be enabled using the valgrind USE flag. See Debugging for instructions on setting up Valgrind.

OpenColorio

Open Colorio provides additional options under the Color Management section of the Scene panel.

Inside blender, select the Render View and Look options, and adjust the exposure, gamma and curves to obtain the desired look.

Opensubdiv

Opensubdiv is a set of libraries that improve subdivision surface modifier evaluation. This can dramatically improve the frame rate of viewing animations in the viewport when using high levels of subdivision.

Not all cards are suitable. The current code checks for geometry shader, GL_ARB_gpu_shader5, glProgramParameteri, glProgramParameteriEXT and glProgramParameteriARB. These are available as part of OpenGL 3.2, 4.0 and 4.1, or as extensions.

Support is enabled via the opensubdiv USE flag.

Inside blender, go to the File->User Preferences->System tab and set OpenSubdiv compute to the desired option. It may be possible to choose the CPU, but cards which support GLSL Compute will give better performance. This box will not appear if the card does not meet the requirements.

Finally check the Use Opensubdiv box in the subdivision surface modifier

OpenVDB

OpenVDB provides a data structure for storing and manipulating volumetric information efficiently. It can be compiled into blender using the openvdb USE flag, and openvdb-compression is also recommended as the data can require upwards of 20MB.

In blender, set the renderer to Cycles Renderer. Go to the physics panel and enable physics for Smoke. In the smoke section select Domain. Save the file to enable editing of the smoke cache. Change File Format to Openvdb and select Blosc compression if desired. Now create and bake the simulation.

Blender 2.72b Specific

Blender 2.72b is quite old and upgrading to 2.78 is strongly recommended.

x86 Intrinsics Compilation

Due to bug #523928 cycles may fail to compile. To work around it, create /etc/portage/patches/media-gfx/blender/blender.redefinition.patch patch file:

diff -Nur old/intern/cycles/util/util_simd.h new/intern/cycles/util/util_simd.h 
--- old/intern/cycles/util/util_simd.h  2014-10-20 03:58:22.000000000 -0400 
+++ new/intern/cycles/util/util_simd.h  2015-02-03 13:29:26.156893414 -0500 
@@ -19,6 +19,7 @@ 
 #define __UTIL_SIMD_TYPES_H__
 
 #include <limits>
+#include <x86intrin.h> 
 
 #include "util_debug.h"
 #include "util_types.h"

(This patch can also be obtained from pastebin if copying and pasting from formatting adds extra spaces that break the patch.)

Nvidia GTX 900 series in Blender 2.72b

Newer Nvidia cards are not supported in Blender 2.72 and upgrading to 2.78 is recommended. However it is possible to patch 2.72b:

  • Unmask and emerge dev-util/nvidia-cuda-toolkit of version 6.5.19 or higher
  • Create a file /etc/portage/patches/media-gfx/blender/blender.sm_52.patch with contents
diff --git a/intern/cycles/kernel/kernel.cu b/intern/cycles/kernel/kernel.cu
index d5b5293..9ed4592 100644
--- a/intern/cycles/kernel/kernel.cu
+++ b/intern/cycles/kernel/kernel.cu
@@ -52,8 +52,8 @@
 #define CUDA_KERNEL_MAX_REGISTERS 63
 #define CUDA_KERNEL_BRANCHED_MAX_REGISTERS 63
 
-/* 5.0 */
-#elif __CUDA_ARCH__ == 500
+/* 5.0 and 5.2 */
+#elif __CUDA_ARCH__ == 500 || __CUDA_ARCH__ == 520
 #define CUDA_MULTIPRESSOR_MAX_REGISTERS 65536
 #define CUDA_MULTIPROCESSOR_MAX_BLOCKS 32
 #define CUDA_BLOCK_MAX_THREADS 1024

Re-emerge Blender:

root #emerge --ask --one-shot media-gfx/blender

See also

External resources