Skip to content

Instantly share code, notes, and snippets.

@lucasw
Last active January 1, 2018 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasw/feedbbc31f8d2877b873190f496368f6 to your computer and use it in GitHub Desktop.
Save lucasw/feedbbc31f8d2877b873190f496368f6 to your computer and use it in GitHub Desktop.
Rendering scenes with blender

Hair - need to set the stiffness up to 1.0 otherwise what is made in particle edit mode will go somewhere else in the object view/render.

Command line render

Render the 80th frame to "test0080.png":

blender -b ../scape14.blend -x 1 -o test -f 80

Need to bake smoke first (creates 10 gigs of cach files in blendcache_scape14 etc., probably could reduce smoke resolution and reduce that greatly).

@lucasw
Copy link
Author

lucasw commented Dec 31, 2017

Render smoke from command line:

import bpy

for scene in bpy.data.scenes:
    for object in scene.objects:
        for modifier in object.modifiers:
            if modifier.type == 'SMOKE':
                if modifier.smoke_type == 'DOMAIN':
                    override = {'scene': scene, 'active_object': object, 'point_cache': modifier.domain_settings.point_cache}
                    bpy.ops.ptcache.bake(override, bake=True)
                    break
$ blender -b ../scape15.blend -P ../cache_smoke.py 
read blend: /home/lwalter/own/blender/render/../scape15.blend
PyContext 'window' not found
PyContext 'window' not found
PyContext 'blend_data' not found
PyContext 'region' not found
PyContext 'area' not found
PyContext 'screen' not found
PyContext 'screen' not found
PyContext 'area' not found

bake: done!
PyContext 'window' not found
PyContext 'region' not found
PyContext 'window' not found
PyContext 'region' not found

Blender quit

doesn't work

https://blender.stackexchange.com/questions/4963/baking-smoke-on-headless-machine

@lucasw
Copy link
Author

lucasw commented Dec 31, 2017

@lucasw
Copy link
Author

lucasw commented Dec 31, 2017

Material displacement textures

higher scale values will make the noise features smaller

Remember if subsurface scattering is on it will tend to blend and obscure fine details.

@lucasw
Copy link
Author

lucasw commented Dec 31, 2017

Big render fails:

Fra:25 Mem:505.35M (0.00M, Peak 1046.94M) | Time:19:31.82 | Remaining:03:24.74 | Mem:718.57M, Peak:718.57M | Scene, RenderLayer | Path Tracing Tile 1530/1786
blender: /build/blender-40PcOX/blender-2.76.b+dfsg0/intern/cycles/kernel/./kernel_compat_cpu.h:69: T ccl::texture<T>::fetch(int) [with T = ccl::float4]: Assertion `index >= 0 && index < width' failed.
Aborted (core dumped)

https://developer.blender.org/T48549

Try rendering a lower res version locally and see if that succeeds- it didn't fail.

1920 x 2400 is fewer tiles - but the crash appeared in a much earlier tile than previously.

It's possible the issue was adding subdivision on a couple of objects that didn't previously have them, could apply both of those.

Next maybe build blender from source?
https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/Ubuntu/CMake

@lucasw
Copy link
Author

lucasw commented Dec 31, 2017

Email self rendered image as attachment after finishing successfully.

https://stackoverflow.com/questions/17359/how-do-i-send-a-file-as-an-email-attachment-using-linux-command-line

blender -b scape16.blend -x 1 -o test16_ -f 25 && echo "new render " | mutt -a test16_0025.png -s "Blender Render" -- foo@bar.com

@lucasw
Copy link
Author

lucasw commented Dec 31, 2017

Build from source for Ubuntu 16.04

cd ~/other/blender_git
./blender/build_files/build_environment/install_deps.sh --source ~/other/blender --install ~/other/blender/install/bin --no-sudo
ERROR! wget could not find http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz, or could not write it to /home/lwalter/other/blender/LLVM-3.4.tar.gz, exiting

New llvm location

http://releases.llvm.org/3.4/llvm-3.4.src.tar.gz

edit install_deps.sh

LLVM_SOURCE=( "http://releases.llvm.org/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" )
LLVM_CLANG_SOURCE=( "http://releases.llvm.org/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" )

Submit a patch

Not as easy as github pull request :(

https://developer.blender.org/differential/diff/create/

https://developer.blender.org/D2983

Build errors

llvm error

CMake Error at cmake/config-ix.cmake:272 (message):
  libffi includes are not found.
Call Stack (most recent call first):
  CMakeLists.txt:264 (include)


-- Configuring incomplete, errors occurred!
See also "/home/lwalter/other/blender/LLVM-3.4/build/CMakeFiles/CMakeOutput.log".
See also "/home/lwalter/other/blender/LLVM-3.4/build/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'clean'.  Stop.
ERROR! LLVM-3.4 failed to compile, exiting
sudo apt install libffi-dev

another error

Another build system gets further:

-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so  
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find PythonLibsUnix (missing: PYTHON_LIBRARY PYTHON_LIBPATH
  PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  build_files/cmake/Modules/FindPythonLibsUnix.cmake:181 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  build_files/cmake/platform/platform_unix.cmake:62 (find_package)
  CMakeLists.txt:872 (include)


-- Configuring incomplete, errors occurred!
See also "/home/lucasw/other/blender-git/build_linux/CMakeFiles/CMakeOutput.log".
See also "/home/lucasw/other/blender-git/build_linux/CMakeFiles/CMakeError.log".
GNUmakefile:123: recipe for target 'all' failed
make: *** [all] Error 1

Probably need to add this:

  -D WITH_CODEC_SNDFILE=ON
  -D PYTHON_VERSION=3.6
  -D PYTHON_ROOT_DIR=/home/lucasw/other/blender/install/bin/python-3.6
  -D WITH_OPENCOLORIO=ON
  -D OPENCOLORIO_ROOT_DIR=/home/lucasw/other/blender/install/bin/ocio
  -D WITH_OPENIMAGEIO=ON
  -D OPENIMAGEIO_ROOT_DIR=/home/lucasw/other/blender/install/bin/oiio
  -D WITH_CYCLES_OSL=ON
  -D WITH_LLVM=ON
  -D LLVM_VERSION=3.4
  -D OSL_ROOT_DIR=/home/lucasw/other/blender/install/bin/osl
  -D LLVM_ROOT_DIR=/home/lucasw/other/blender/install/bin/llvm
  -D LLVM_STATIC=ON
  -D WITH_OPENSUBDIV=ON
  -D OPENSUBDIV_ROOT_DIR=/home/lucasw/other/blender/install/bin/osd
  -D WITH_OPENVDB=ON
  -D WITH_OPENVDB_BLOSC=ON
  -D WITH_ALEMBIC=ON
  -D ALEMBIC_ROOT_DIR=/home/lucasw/other/blender/install/bin/alembic
./blender/build_files/build_environment/install_deps.sh: line 4156: gawk: command not found
dpkg-query: package 'libx264-dev' is not installed
dpkg-query: package 'libopenjpeg-dev' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
  -D WITH_CODEC_FFMPEG=ON
  -D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;'
sudo apt install gawk libx264-dev
make -j16 BUILD_CMAKE_ARGS="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost* -U *OPENCOLORIO* -U *O$ 
ENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES* -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* 
-U *ALEMBIC* -D WITH_CODEC_SNDFILE=ON -D PYTHON_VERSION=3.6 -D PYTHON_ROOT_DIR=/home/lwalter/other/b
lender/install/bin/python-3.6 -D WITH_OPENCOLORIO=ON -D OPENCOLORIO_ROOT_DIR=/home/lwalter/other/ble
nder/install/bin/ocio -D WITH_OPENIMAGEIO=ON -D OPENIMAGEIO_ROOT_DIR=/home/lwalter/other/blender/ins
tall/bin/oiio -D WITH_CYCLES_OSL=ON -D WITH_LLVM=ON -D LLVM_VERSION=3.4 -D OSL_ROOT_DIR=/home/lwalte
r/other/blender/install/bin/osl -D LLVM_ROOT_DIR=/home/lwalter/other/blender/install/bin/llvm -D LLV
M_STATIC=ON -D WITH_OPENSUBDIV=ON -D OPENSUBDIV_ROOT_DIR=/home/lwalter/other/blender/install/bin/osd
 -D WITH_OPENVDB=ON -D WITH_OPENVDB_BLOSC=ON -D WITH_ALEMBIC=ON -D ALEMBIC_ROOT_DIR=/home/lwalter/ot
 her/blender/install/bin/alembic -D WITH_CODEC_FFMPEG=ON -D FFMPEG_LIBRARIES='avformat;avcodec;avutil 
 ;avdevice;swscale;swresample;lzma;rt;theoradec;theora;theoraenc;vorbisenc;vorbisfile;vorbis;ogg;x264 
 ;openjpeg;openjpeg_JPWL'"

@lucasw
Copy link
Author

lucasw commented Jan 1, 2018

On one system accidentally installed to /opt/lib, and can run the new blender binary, but on other installed to ~/other/blender/install and it can't find the libs.

Temporary fix:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/other/blender/install/bin/oiio/lib/:~/other/blender/install/bin/osd/lib:~/other/blender/install/bin/osl/lib:~/other/blender/install/bin/alembic/lib

~/other/blender_git/build_linux/bin/blender -b scape16.blend -x 1 -o test16_ -f 25 && echo "new render " | mutt -a test16_0025.png -s "Blender Render" -- foo@bar.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment