Setup : Blender 2.82

I want to achieve something similar to what was represented below but through a python script.

If each cube here represents a pixel, what is the fastest way to change its color so it looks exactly like the 2d image?

  1. I wonder if it is possible to put there an actual RGB photo and not just a number?
  2. I am also curios if i can map on a face of an cube a full image like a feature map from a tensorflow model ?

Here is the code that i have atm for creating cubes at different location in different collections

def createCubes(x,y,z, name):
  collection = bpy.data.collections.new(name= name) 
  k = 0
  l = 0
  for i in range(0,int(z)):
      for j in range(0, int(x)):
        bpy.ops.mesh.primitive_cube_add(location=(k, y,  l ))
        bpy.context.active_object.name = 'cube'
        cube = bpy.context.object
        for ob in cube.users_collection[:]: 
        k= k+3
      l = l + 3
      k = 0

1 Answer 1


you have to use opencv a python library for image processing so that you can map a full image.

  • $\begingroup$ Could you give an example of use? $\endgroup$ Commented Apr 5, 2020 at 10:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .