Objects Creation

Hi, i’m a student and i have to use blender/python for an academic project.
I need create 200k cells (i already have xyz for all of them).
cicle:
name=‘number’+str(id_cell)
mesh=bpy.data.meshes.new(name)
verts = [(0,0,0),(0,5,0),(5,5,0),(5,0,0)]
faces = [(0,1,2,3)]
mesh.from_pydata(verts,[],faces)
obj=bpy.data.objects.new(name,mesh)
items.append(obj)
//other
for item in items:
bpy.context.scene.objects.link(item)
I take about 12 hours to create them and I think it’s too much. After, I add keyframes to the materials (diffuse_color) for the animation. Can you give me some tips? I’m sure I can speed up objects creation but i don’t know how.
(Bad english, sorry)

Nobody can help me?

are these cells simple planes with one color + a keyframe

in any case 200K is a huge amount and could take a very long time

can you show pic of what you mean might help to help!

creation of anything higher then a few 1000 will make bl sluggish in any case!

again here do you re use color or have 200 K colors ?

happy bl


This is just a piece of all. For the animation I need 200k different materials, cause any plane must be indipendent. But if you say that even 1k is huge, I should resize this model

on time I did add like 20 K plane with 20 K text name
and it took a few seconds to do

I really don’t know if it is possible to go to 200 K objects and materials with colors
you have to experiment and see if it can works and not overflow memory and create errors!

what are each object and verts counts ?
is it a circle or a plane
first post show only 4 points ?

don’t think blender can really go over a few millions verts
mind you if you use instancing it could go higher!

only testing will determine if it is possible I guess

do you have copy of script to test it ?

do you read a data file for verts or locations ?

what is the var number and id-cell?
in name=‘number’+str(id_cell)

don’t see a for loop for that ?

for intro see this thread

https://blenderartists.org/forum/showthread.php?299435-Need-Help-Optimizing-A-Script-To-Make-It-Less-Time-Consuming

happy bl

Deppending on how many vertices you actually need if there would be a possible way to create one large mesh instead of alot of small objects it could solve your problem. The amount of materials on the object might cause poor performance in 3d view/consume memory.

Animating vertex colors using a script instead of a materials is probably more efficient, if you only change color and not the material look. If you need different “material types” you could use vertex colors to control the different materials using a single material. However i have no idea if the second option would be efficient but they would probably perform better then 200k meshes.

I hope any of the ideas help and they should probably be doable within blender ! :slight_smile:

Ricky, yes every object is just a plane. I dont use primitive_plane_add() cause the update for every objects creation is insane! I create 4 verts and then I read xyz from a file (first piece of code is in a for loop). ‘Numer’ is a string and id cell is another variable that i use to create object’s name.
Osares,unfortunately, I cant use a single object cause every object is a cell (it’s a biological item). Can you tell me something about animating vertex colors? I just need independent color for every object, for this reason i cant use a single material :frowning: