Preliminary code for plotting data in Blender.
Show various ways in which the Blender Python API, called bpy
, can be used to generate meshes, shaders and vector graphics.
These examples are intended to help you code your own visualizations, and can be used on their own or as part of the sci_viz
module.
These are tagged depending on if they are visible in a render or only in the 3d viewport. Where it makes sense, examples of both are given.
Scatter plots
(x,y,z)
tuples and generates vertices (non render)(x,y,z)
tuples and generates single color dots (small icospheres)(renderable)((x,y,z),(r,g,b,a))
tuples and generates colored dots (renderable)(x,y,z)
tuples and generates vertices (non render)Line plots
(x,y,z)
tuples and generates, edge based mesh (non render)3D surface plot
(x,y,z)
tuples and generates a mesh (renderable)(x,y,z)
tuples and generates a mesh (renderable)Node scripting
"Node.001|Color > MixRGB.002|0"
. Full grammar specs are in the file.General obj utility scripts
mix, max and distance
for an object, calculated in world or local coordinatesThe sci_viz module
The sci_viz
module can be placed inside the blender scripts folder like ../scripts/modules/sci_viz
, to conveniently import the various utilities.
For example if you need to make a series of node links then add these lines to the top of your python script and you can use the node mini grammar to connect nodes.
import sci_viz
from sci_viz.node_tools import make_link
Here's a broad collection curated recipes. (still work in progress): https://github.com/zeffii/BlenderPythonRecipes/wiki