I made a simple blender model to output the RGB, Depth and Mask picture respectively.
As shown in the image below, there are many cars of the same type on the ground in both RGB image and depth image, however the Mask image only shows one car. Note that the car is in the same type, if I used n different types of cars, the mask picture will show only n different cars.
This is my node
Any ideas ?
I know what goes wrong here, it is nothing about the model but because of the object index.
In my model, i have only one object, then I used the code to duplicate to many more, therefore probably the new generated object has not the same object index as the original one.
Here is my code for creating a new object.
obj = bpy.data.objects[name]
mesh = obj.data
new_obj = bpy.data.objects.new(name, mesh)
new_obj.rotation_mode = 'XYZ'# Force the right rotation mode
new_obj.pass_index = 4
Though you have shown me the way to give the objects the same object index manually, I tried to give the object the pass_index, and it worked.