Posterize files

Here a script  (R13) + tutorial explaining the Python code behind it, to posterize files.
For example, this icon was ‘posterized’.

 

The script asks for an input file and some input variables.
Then, based on given input factor, the average pixel color is calculated, an object (Cube or Sphere) is created and a material with the calculated average color created and assigned.

 

 

 

 

 

 

Example: The file is 512×512 and the input factor is 32.
This means that the picture will be ‘divide / posterized’  in 512 / 32 = 16 parts.
Each part is sampled and the average color is calculated. For each part an new objects will be created with the calculated average color.
In total 16*16 = 512 objects will be created.

Here you can download the source and an tutorial explaining the use and the Python code behind it.

Tutorial: Calculate Voronoi using a brute method

This tutorial shows how to calculate (in Python) 2D Voronoi using a brute method. Voronoi is often used to scatter or explode objects.

Note: In mathematics, a Voronoi diagram is a special kind of decomposition of a metric space, determined by distances to a specified family of objects (subsets) in the space.

 

In this tutorial you will learn:
– Get all polygons of an object.
– Calculate distance between an object and a polygon
(between a Null object and a point of the polygon).
– Add polygon, based on distance, to a selection.

Here you can download the source used in the tutorial.

Note: This is only a 2D solution. I’m still investigation a 3D solution. Any help is welcome!

Xpresso Logging Node

This Xpresso Logging Node can be used to log Xpresso information to a logfile.

Input:

  • Enable
    If True, information will be written (appended) to the logfile.
  • TextField
    This field is written to the logfile and can be used to describe the input value.
  • Input
    This field is written to the logfile
    Note: Most Xpresso variables are accepted. Particle Groups are not yet accepted.

Output:

Logfile: Date – Time – TextField – Input

Here you can download information (pdf) on the Xpresso Logging Node and a c4d example file. This example compares the local and global positions of particles.

The manual (pdf) file also contains and explains the Python code used in the Xpresso node.