Archive for ‘Open Source’

gennaio 18, 2014

Colors/Groups Exchanger (add-on)

Working in parametric design with a particular focus on blender’s parametric features, and the possibilities to exchanging information from/to other softwares I started to develop this new add-on.

During last workshop adaptABILITY in Bratilsava, Andrea Graziano and me introduced participants to some strategies for connecting blender to grasshopper through informations stored in vertex colors that can be exported as .ply file without need of scripting.

In blender there are quite interesting tools for working with vertex colors and vertex groups (vertex weight) but there is no an easy way for create a connection between these two layers of information stored inside the vertices of the mesh.

The add-on that I prepared is called Colors/Groups Exchanger and it allows to use two different commands: Vertex Colors to Vertex Groups and Vertex Group to Vertex Colors.

Vertex Colors to Vertex Groups

Sometimes can be useful to use informations of vertex colors in order to control some modifiers, physics or the behaviour of shape-keys.



Using this command it is possible to store one or more colors channels inside vertex groups (gray, red, blue, green, inverted).


For instance vertex colors are pretty useful for creating a grayscale map containing informations about mesh curvature. This tool is called Dirty Vertex Colors:


Or maybe you prefer to use light shading for parametrically control some particular effect on the surface of your geometry:


Or simply use some colors information incoming from external softwares for interact with your geometry.


Vertex Group to Vertex Colors

The second command that I’m going to explain is Vertex Group to Vertex Colors. It allows to move information from vertex-weight groups to colors, maybe because you want to export these informations to external softwares or simply because you want to render vertex groups.



One of the coolest way to work with vertex weight is to use some dedicated modifiers, like for instance Vertex Weight Proximity:


We are waiting to do a new workshop about Blender and Grasshopper in order to going deeper in this interesting topic. Check Co-de-iT website for updates, or tell us if you would like that we organize one in your city.



novembre 11, 2013

Adaptive DupliFaces (add-on)


During the adaptABILITY workshop in Bratislava, Co-de-iT‘s team (Andrea Graziano and me) focused on several strategies about the connection between Blender and Grasshopper as tools for computational design in architecture. In latest years the development of blender went very fast and a lot of very useful features in computational design emerged, thanks to the community of developers. Looking at some very diffused panelizations strategies in grasshopper I decided to propose something similar in blender, that I called “Adaptive DupliFaces”.

In this rought version it’s possible to define one or more component meshes, and a base mesh. Select at first the components and then the base mesh, therefore run the command “Adaptive DupliFaces” for moving and adapting the panels for every face of the base mesh. Currently there are no options, but as soon as possible I’ll implement more feature for controlling the proliferation. Until then there are some rules to observe:



. the base mesh must be composed by quadrilateral faces. Triangles and polygons can give some weird results;

. the component mesh coordinates in x and y will be reproduced in faces UV, considering both x and y going from 0 to 1;


. until now there is no control on the component rotation, it depends on face’s indexing;

. at moment, z coordinate is fixed and must be resized in original component before Dupli Morph operation.

You can download the addon at the link:

Following you can check some quick tests that show some applications of Adaptive DupliFaces. It was developed for architectural works, but I think that it could be useful also in different fields.


Pleas post your questions or your works done with Adaptive DupliFaces!

Cheers 😉

aprile 24, 2013

dual meshes in blender

000 - cover_fx

Thanks to introduction of b-mesh it’s possible in blender, starting from a triangulated, to obtain a polygonal mesh in blender. This kind of polygonal mesh is called dual mesh.

Create a generic mesh surface in blender and then triangulate that. You can use the shortcut ctrl+T. Generally I suggest to start from a regular quad-grid, in order to achieve a more regular dual mesh:

001 - starting mesh

002 - triangulate

Now, add and apply a subsurf modifier, leaving the default settings. Now your mesh contains vertices of both starting and dual mesh. We need to surgically remove the starting mesh:

003 - subsurf modifier

For do that, we must select a vertice of the dual mesh. You can recognize it because it’s conected only to three edges. Now prest ctrl+ for “select more”:

004 - select more

Use now “select similar” tool (shift+G), and choose the option “Amount of Adjacent Faces” for select all similar vertices.
Invert the selection with ctrl+I and “Dissolve” the selected vertices:

005 - select similar

Now select one of the vertices connected to only two edges and use again the tool “select similar”. This time use the option “Amount of Connecting Edges”, and then dissolve all the selected vertices:

006 - select similar

Sometimes it’s possible that some quad faces must to be clean in a second moment, in this case you can use the same procedure for select all similar vertices. Furthermore, if your mesh is open, probably you have to clean the borders. To doing that quickly, you can simply use “Select Non Manifold” for select and delete the border vertices.

Here you can see the resulting mesh:

007 - final result

If you are lazy like me, you can also use a script that I created in order to automatically calculate the dual mesh: For do that, simply copy and paste the code inside the blender’s text editor, select your mesh and run the script.


luglio 23, 2012

spectrum { embodiments } – processing workshop in Rovinj (Croatia)

spectrum { embodiments }
Hotel LONE | Rovinj | Croatia | 27th – 31st August 2012

The more we explore the architecture of matter, the more what we get looks more and more like information; yet, infor-
mation needs a body in order to express itself as such. Architecture starts when the embodiment process takes place,
from the set of relations that define a system, by defining relations among independent objects (which, in turn, are
information systems on a finer scale). By coding the behavioral rules of interacting autonomous agents and topological
manifolds, emergent hierarchies and differentiated yet coherently related spatial and geometric conditions flourish form-
ing a spectrum (a condition that is not limited to a specific set of values but can vary infinitely within a continuum), with
a cascade of local symmetries, gradients and singularities emerging from pure information systems.
The workshop will speculate through codes written in Processing on autonomy of form and the relation among behavioral
rules and morphogenesis. Rather than trying to reductively solve dualities like autonomy/dependency, whole/parts, het-
erogeneity/homogeneity the workshop aims to exploit them as a fuel for dynamic, competitive or collaborative creation of
higher complexity and the source of a spectrum of possibilities in finding novel forms.seeable forms with no precedents.
We will write our own unconventional programming strategies in the scripting- framework Processing.

Alessio Erioli, Tommaso Casucci, Alessandro Zomparelli
Co-de-iT – Computational design Italy –
a collaboration between Co-de-iT and MLAUS / proto/e/co/logics


luglio 23, 2012

Blender: Random Material Assigner (to BMesh N-gons)

This is a simple script for assignement of random materials to different faces (n-gons) of a single object. It works differently to the existing Random Material Assigner and the mine is a version very rough. I wrote this script because for the particular job that I had to do it was more comfortable handling a single object to be fixed as a random mosaic, rather than a very large number of different objects. Here is the code:

import bpy
import bmesh
import random

obj = bpy.context.active_object
mesh =

bm =

for f in bm.faces:
    f.material_index = int(random.random()*len(obj.material_slots))



novembre 15, 2011

Blender Real-time Exporter (simple version)

Sometimes, working with tools like Processing or Grasshopper I’ve felt the lack of maneuverability of blender meshes modeling. I therefore decided to develop a small script for export my mesh refreshing it in real-time. This will make it possible to read information from different software programs interactively with the ability to store files prefix.vertices and prefix.faces, containing respectively the vertices and faces of the mesh.
Is also possible to simultaneously export multiple objects with the ability to apply the modifiers before exporting. The export deals only with the mesh, so there are not applied the transformations like translation / rotation / scale of the object.

Following is a brief description of the syntax adopted for export .vertices file:

vertex_01_x vertex_01_y vertex_01_z
vertex_02_x vertex_02_y vertex_02_z
vertex_03_x vertex_03_y vertex_03_z
vertex_04_x vertex_04_y vertex_04_z
vertex_05_x vertex_05_y vertex_05_z

and .faces file:

face_01_vertex_01_ID face_01_vertex_02_ID face_01_vertex_03_ID face_01_vertex_04_ID
face_02_vertex_01_ID face_02_vertex_02_ID face_02_vertex_03_ID face_02_vertex_04_ID
face_03_vertex_01_ID face_03_vertex_02_ID face_03_vertex_03_ID face_03_vertex_04_ID
face_04_vertex_01_ID face_04_vertex_02_ID face_04_vertex_03_ID face_04_vertex_04_ID

In the future, the intention would be to expand export opportunities allowing you to export files with different formats and reporting information about the vertex-colors.

Installation of Blender Real-time Exporter:
Download and open it with blender text editor, press Alt-P for run the script and in Object Data menu it will appear the new panel: Real-time Mesh Exporter.

You can also try the exporter with my simple Processing sketch BlenderToProcessing.pde. I don’t use libraries like toxiclibs or hemesh, but only Processing function beginShape(). So with particular quad faces it gives some errors of visualization.

Happy Blending


Here is an updated versione of the script to blender 2.69:

maggio 15, 2011

Benchmark in

Trying to better understand the functioning of the Java language (in particular of processing) I decided to build a small class of benchmark with which to keep monitored the duration of some operations computationally expensive. The usage of the class is very simple: copy the file. pde in the folder of your sketch and open the main file (for example mySketch.pde in a folder with the same name “mySketch”). The usage that I suggested (but you are free to adapt it to your taste and your needs) is to declare an instance of the class benchmark at the beginning of the code, then the instance will be initialized at the beginning of phase to be monitored specifying the subject of control (a simple string that will be reported in the console) and successively is close. Will then appear on the console the duration of the operation (or loop of operations), in milliseconds. You don’t need to create a new instance of the benchmark class for each control, just overwrite the same every time.

usage example:

benchmark myBenchmark;

... code ...

myBenchmark = new benchmark("myOperation time");
myBenchmark.end(); //return in console "myOperation time: ###ms"


myBenchmark = new benchmark("myAnotherOperation time");
...another operation...
myBenchmark.end(); //return in console "myAnotherOperation time: ###ms"

This is really simple, but I hope useful.

download benchmark.pde

I improved my benchmark using class method static instead of default instance. In this way it is not possible to output nested benchmark controls (you can have a nested control copying the class with a different name for every hierarchy level) on the other hand it is possible to access to benchmark methods without having to instantiate the generic class benchmark.
I also insert a memory control that display total memory used by virtual machine and a delta memory that, after the calling of garbage collector, evaluate the memory used by myOperation.

usage example:

... operations ...


example of benchmark output

download benchmark_static.pde

aprile 6, 2011

voxel analysis for implicit surfaces

This is my first test with implicit surfaces. I tried to voxelize a sort of rheotomic surface, defined by rules of iso-distance between nearest elements of two differtent groups (1 point+2 curves for first group and 2 points+1 curve for the second one).

In a first moment, I tested the brute-force samplyng method, in order to search for a way to sample points belonging to implicit surfaces. This expensive method consists of analyzing all possible solutions and the subsequent evaluation of results. In this case I needed to verify each point of my 3D grid and improving the resolution, i obtained  8^n points every n divisions of main domain.

A better solution consists in a progressive analysis: starting from a domain, and progressively dividing positive matched cubes (later I learned that this approach already exists with the name of Quadtree):

Sampling Scheme

Explanation of progressive sampling method.

Coding it with c# in grasshopper, I obtained a relatively complex point cloud:

Rheotomic surface_002

Point Cloud otup in grasshopper

This coarse approximation isn’t at the moment enough accurated for obtaining clean surfaces, however I tried to connect resulting point-cloud with MeshLab. After a quick editing in Blender, I rendered the output:

Rheotomic surface_001

Final Mesh

At the moment I’m working on the improvement of the quality of point-cloud and subsequent elegance of the resulting mesh.