I have a 3d small garden with 15 plants. Each plant have leaf objects. Formally they are just a leaf objects with different XYZ location/rotation/scale. Take a look
I want to get something similar to this image:
I need to make an RGB mask of my garden? How do I make it?
I'm thinking of creating a new materials and give them random coloring and then apply materials on my leaf objects, that would work too I suppose, but I believe there should be an easier and better way.
Here's my script:
for obj in [o for o in source_collection.objects if o.type == 'MESH']: for i in range(1): for obj in [o for o in source_collection.objects if o.type == 'MESH']: # get a copy of the object new_obj = duplicate( obj, destination_collection, False ) # ** Make your random transforms here ** RGBMask = bpy.data.materials.new("RGBMask") bpy.context.active_object.data.materials.append(RGBMask) bpy.data.materials["RGBMask"].diffuse_color = random(), random(), random(), random() rotateX = round(uniform(-20,20), 2) rotateY = round(uniform(10,50), 2) rotateZ = randint(-760,760) scaleX = round(uniform(0.3,1), 2) scaleY = round(uniform(0.3,1), 2) scaleZ = round(uniform(0.3,1), 2) new_obj.scale = ( scaleX, scaleY, scaleZ ) new_obj.rotation_euler = (radians(rotateX),radians(rotateY),radians(rotateZ))
It creates new material called RGBMask, but applies it for all of my objects, but I need to have each leaf have it's own color. I'm new to python and blender, so any help is highly appreciated