This article builds on my previous blog post. I will go over how I personally make protein animiations and work with Blender. Note that I am a novice with blender, so there are definitely things that could be improved. I appreciate any tips and tricks; please email be and I’ll include them.
So you have the structure open in blender, what now? Unless you are rendering a very small scene or have a very powerful device you are working on, I recommend taking a minute to try to minimise the computational impact your model has. While I’m sure there are many good ways to do this, I personally use either of the following two:
Remesh takes the longest to compute, but seems to be best for very large structures. For the decimate modifier, I would recommend the ‘planar’ option and just increase the angle to acceptable levels. After you find something you like, right click on the protein surface in the viewport and click ‘shade smooth’; this will make for nicer looking interpolation of the vertices. For the remesh modifier, start with a low number (should be by 4 default) and increase 1 at a time until you find the detail to be close enough to the original. Make note of the original vertex count and what the count is after the remesh. You’ll want o make sure it’s lower after the remesh. For remesh, tick the ‘smooth shading’ box instead of the method above. Once you think you have reduced the number of vertices enough you can get to the fun part: creating your scene.
This section is for people new to blender
For my work I only use the two tabs highlighted in red in blender. The tabs are just presets for what windows should be open; in principle you can rearrange each of the tabs to look like another.
Lets go over the other buttons that would be important to use:
For protein structures, I would recommend you reserve the imported structures as templates and only work with copies in the scene (just ctrl-c ctrl-v). It would be wise to first arrange the objects and only then worry about surface appearance and lighting.
Basic navigation: the numberpad will allow for basic viewing angles (x,y,z, camera). pressing and holding down middle mouse will allow for free panning around a rotation point. Double pressing ‘.’ on the numpad will centre the rotation point on the selected object.
To animate, it is easiest to use blender’s keyframes. In fact, using blender’s graphical interface and combining with the scripting is smarter than trying to do everything by scripting. Arranging the scene and animating is easier with the blender tools. We time our animation with the help of the animation timeline. This can be accessed by adding a new window to the viewport by sliding up on the bottom left of the 3D viewport in the ‘overview’ tab (orange in image below). You know you can add a new subwindow once your cursur turns to a crosshair. You can then select ‘timeline’ for the new subwindow in the dropdown in the topleft (cyan in image below) (or press shift + F12).
You then set up all animation based on keyframes. This is a good starting point. You can then sync these up with your python by setting the current timepoint via python.
You can do python scripting straight from blender. It should also be possible to link to external files, but this was giving me a bit of trouble so I just did everything in the same file. To allow your python script to interface with blender you just have to add ‘import bpy’ to your imports.
There are two consoles in blender. One is part of a subwindow just like all objects in blender, and one is the ‘main’ console. Print statements get displayed in the latter, so that one is the most useful. You open it by [window] -> [toggle system console] in the top left of blender.