Make scripted visualizations in blender
The goal of this project is to script 3D scientific visualizations using blender.
To achieve this, we aim to bring together blender’s powerful visualization toolkit with Anaconda’s scientific computing and package management capabilities. For example, the code in ./apps/concepts/fourier_signal_composition.py was used to generate the following visualization.
See the detailed setup instructions at the end of the file.
This project is still a work in progress. Contributions and feedback are welcome!
Files in the directories apps and illustrations are copyright praneethnamburi.
The general purpose blender scripting code (bpn, pntools) is under the MIT license.
These are detailed instructions that worked for me on a windows 10 laptop.
- A useful tip is to check if you're able to find the correct python, pip, conda and blender commands from your command prompt. Most of the issues I encountered had something to do with the correct paths.
- Use 'where blender' in the windows command prompt inside VSCode
- Result: C:\\blender\\3.0.0\\blender.exe
- where python
- C:\\Users\\Praneeth\\.conda\\envs\\blender3\\python.exe
- where conda
- C:\\ProgramData\\Anaconda3\\condabin\\conda.bat
This folder contains authentication keys for interfacing with
applications. Don’t commit this when working with multiple people.
Notes for development and learning during the course of the project.
_requirements_topLevel.txt is meant to help with python’s package
management. It is a good idea to add this to source control when
developing with multiple people, but this will eventually disappear from
distribution.
Local cache for storing intermediate data generated by the software.
Applications that use the main package bpn, and supporting package pntools. See License.
This folder contains the core scripts for using
core module has wrappers around blender objects, divided into three types:
1) Thing - class that initializes all wrappers
2) Object, Mesh, Collection, GreasePencil - wrappers around bpy.data.(*)
3) MeshObject, GreasePencilObject - Initialize object + data
names are very important in bpn. We use names to insulate bpn from bpy. That means, bpn tries very hard not to keep a copy of things from bpy. Instead, it tries to get the appropriate information from bpy when needed. names determine the interaction between bpy and bpn.
args are for the ‘new’ function to create a new blender data instance kwargs are for initializing that instance inside bpy.data.(type).(instance)
Objects and lights need to pass one argument through args. I did not set it to have the flexibility of initializing empty objects with Nonetype.
Classes inherited from Object also send args up to Thing class (e.g. MeshObject, and GreasePencilObject)
Rest of them ONLY send kwargs for initialization.
Modules vef, trf and env currently do not depend on any other files within bpn.
env requires blender and therefore, will stay within bpn, but the other two can become their own packages that bpn uses. Perhaps move them to pntools?
General python tools that were developed with this proejct, but can generalize beyond this project.
The purpose is to bring bpn’s functionality into blender’s python console with one command. At the blender console, type from bpn_init import *