Skip to content

Blender

Blender is a free and open-source software (FOSS) for 3D modeling and animation. Blender is available for Windows, macOS and Linux.

Personal Experience

I used to prefer SketchUp to Blender for 3D modeling as it had far more intuitive controls. This changed with the release of Blender 2.8 which completely reorganised the UI and changed the default controls. Previously Blender had used a confusing right-click select method which absolutely baffled new users. This fundamental barrier for new users was completely removed by implementing the same left-click selection method used by virtually all other software. It really is the simple things!

Blender 2.8 also introduced a new physically based real-time renderer Eevee and a range of other features. Since the release of Blender 2.8 there has been an explosion new plugins and community tutorials showing how to yse them. While SketchUp remains very simple and intuitive for architectural modelling, its a much more limited tool. Its acquisition by Trimble, new licensing, and the change from a downloadable desktop application to a less powerful online tool have made SketchUp much less attractive to me. For that reason I'm moving all my 3D modelling workflows over to Blender as my primary choice for 3D modeling.

Tools & Software Integrations

  • Python Interpreter - Blender has an embedded Python interpreter which is loaded when Blender is started and stays active while Blender is running. The Python interface allows you to programmatically control most aspects of Blender such as modifying scenes and objects, scripting import and export procedues for meshes and materials, and creating animations procedurally. In addition to the functions provided with Blender, standard Python modules can also be installed. Refer to Blender Python API Documentation for further details.
  • Blender Development in VS Code - A Microsoft VS Code extenstion which let's you write Python code in Visual Studio Code while debugging live in Blender. The extension allows you to work on standalone scripts or create full Blender addons. This plugin can be installed within VS Code by searching for 'Blender Development' in the extensions panel.
  • Archimesh - This plugin can be used to quickly create architectural elements including rooms, doors, windows, stairs and roofs amongst others. The plugin is bundled with Blender but needs to be activated in your preferences.
  • Archipack - This plugin provides a collection of parametric objects like walls, windows, doors, floors and stairs. Using these elements help reduce modelling time. The plugin can be downloaded for free from the project's GitHub repository.
  • BlenderBIM - This plugin enables users to create detailed, data-rich, [[IFC]] compliant [[BIM]] models for free. This plugin can be downloaded from the project's website. The website also provides useful tutorials and training documentation.
  • BlenderGIS - This plugin enables you to create 3D scenes by importing satellite imagery, elevation data and [[OSM]] building geometries from the web. The plugin can read shapefile and raster data into Blender, andperform coordinate reference system (CRS) reprojections. The plugin also includes additional functions for georeferencing photos, terrain analysis, Earth curvature correction, and exporting to 3D shapefile. This plugin needs to be downloaded via GitHub.
  • Building Tools - This plugin enables procedural generation of building exteriors including floors, walls, doors, windows, roofs, balconies and stairs. The plugin can be downloaded from the Building Tools website.
  • Scatter Objects - This plugin allows the user to scatter objects on a mesh or surface. Parameters can be changed to increase randomness. The plugin is already built in to Blender but may need to be enabled in your Blender preferences.
  • Sverchock - Sverchok is a parametric CAD tool for Blender that can generate complex 3D forms using a node system to control the flow of math and geometry. It provides Blender with a similar node and flow-based to interface to those found in Grasshopper for Rhinocerous3D or Autodesk Dynamo. The plugin is downloaded via the project's GitHub repository.
  • VI-Suite - VI-Suite functions as a pre/post processor for the Radiance and EnergyPlus building simulation tools as well as providinf various building context analyses. It offers 2D plotting of EnergyPlus weather files, dynamic sun path creation with real-time shading and physically based lighting, wind rose creation and 2D plotting of wind data. shadow study analysis, daylight factor, illuminance and irradiance, building temperatures and heating/cooling consumption. On Linux machines it also provides an interface to OpenFoam. The plugin needs to be downloaded from GitHub. Details and documentation available from the University of Brighton.

Resources

Notes and Troubleshooting

Blender Development in VS Extension Fails

  • Read the stack trace when trying to connect to Blender in the VS Studio terminal. It may indicate a cause such as could not install debugpy.
  • Run the command line with administrator privileges.
  • Manually install the project requirments:
"c:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin\python.EXE" -m pip install debugpy click flask
  • NOTE: Make sure to specify the correct Blender version by changing the numbers in the Blender 3.0\3.0\ path specified for the pip install command.
  • Retest the connection to Blender by pressing CTRL + SHFT + P, selecting Blender: Start and specifying the Blender installation.

Source: Version 0.0.15 could not install debugpy

Importing OBJ Models from FME to Blender

  • Select File > Import > Wavefront (.obj).
  • Navigate to OBJ file.
  • Set 'Up' parameter to 'Z Up'.
  • Click 'Import Model'.

Move object pivot to world origin (0,0,0) without moving object

  • Select object.
  • Copy and paste the following script in to the Blender text editor:
import bpy
from mathutils import Vector, Matrix

def set_origin(ob, global_origin=Vector()):
    mw = ob.matrix_world
    o = mw.inverted() @ Vector(global_origin)
    ob.data.transform(Matrix.Translation(-o))
    mw.translation = global_origin

# Call function
set_origin(bpy.context.object)
  • Click 'run'.

Source: How can I move the pivot/gizmo to (0,0,0) in a Python script?

Move selected objects to world origin using script

  • Select object.
  • Copy and paste the following script in to the Blender text editor:
import bpy
from mathutils import Vector

# Determine minima of the object
min_x = min_y = min_z = 999999.0
for vertex in om.data.vertices:
    # Translate object vertices from local space to world space
    v_world = om.matrix_world @ Vector((vertex.co[0], vertex.co[1], vertex.co[2]))

    if v_world[0] < min_x:
        min_x = v_world[0]

    if v_world[1] < min_y:
        min_y = v_world[1]

    if v_world[2] < min_z:
        min_z = v_world[2]

# Convert to world Coordinates again
size = om.matrix_world @ om.dimensions

# Calculate global transform
global_transform = Vector((min_x +  size.x/2, min_y - size.y/2, min_z))

# Move to origin
om.location = om.location - global_transform
  • Click 'run'.
  • The selected geometry will be moved near to the Blender origin (0,0,0).

Source: How to center object in global coordinate system?

Remove all materials from selected object

  • Select object.
  • Copy and paste the following script in to the Blender text editor:
import bpy

for i in range(0,len(bpy.context.object.material_slots)):
    bpy.context.object.active_material_index = 1
    bpy.ops.object.material_slot_remove()

    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.ops.mesh.select_all(action = 'SELECT')
    bpy.ops.object.material_slot_assign()
    bpy.ops.object.mode_set(mode = 'OBJECT')
  • Click 'run'.
  • All textures will now be removed from the selected object.

Select Objects in Blender with Python

  • Select an object in the scene and make it the active object:
# Get a reference to the object
obj = bpy.context.scene.objects["Cube"]
# Deselect all objects
bpy.ops.object.select_all(action='DESELECT')
# Make the cube the active object via reference
bpy.context.view_layer.objects.active = obj
# Select the cube
obj.select_set(True)
  • Select multiple objects by name:
for o in ("Cube", "Camera", "Light"):
   obj = bpy.context.scene.objects.get(o)
   if obj: obj.select_set(True)
  • Select all objects of a certain collection:
col = bpy.data.collections.get("Collection")
if col:
   for obj in col.objects:
       obj.select_set(True)

Source: Python: Selecting object by name in 2.8

Set Near and Far Clipping Planes for 3D view and Cameras

  • To change the 3D view clipping distances:
    • Select 'Layout' in the menu at the top of the screen.
    • Select the 'View' tab in the sidebar to the right of the 3D view panel.
    • Set values for 'Clip Start' and 'End' as required (e.g. 0.1m to 20000m).
  • To change the clipping distances for a camera:
    • Select the relevant camera.
    • Select the camera icon in the camera's properties panel.
    • Open the 'Lens' dropdown.
    • Set values for 'Clip Start' and 'End' as required (e.g. 0.1m to 20000m).

Source: BlenderGIS: Adjust 3D view