DLR-RM / BlenderProc

A procedural Blender pipeline for photorealistic training image generation
GNU General Public License v3.0
2.82k stars 451 forks source link

My object is completely inside one another, with a Warning. #1133

Closed bb0928 closed 3 months ago

bb0928 commented 3 months ago

Describe the issue

I am using blenderproc to render scenes for BOP dataset. I use one bop_obj for target object while using "tyol" dataset for distracting object. However, almost every time i run my script, there is a warning like below: " Warning: Detected that obj_000004 is completely inside obj_000001. This might be wrong, if obj_000001 is not water tight or has incorrect normals. If that is the case, consider setting skip_inside_check to True. Warning: Detected that obj_000004 is completely inside obj_000001. This might be wrong, if obj_000001 is not water tight or has incorrect normals. If that is the case, consider setting skip_inside_check to True. Warning: Detected that obj_000004 is completely inside obj_000001. This might be wrong, if obj_000001 is not water tight or has incorrect normals. If that is the case, consider setting skip_inside_check to True. Warning: Detected that obj_000004 is completely inside obj_000001. This might be wrong, if obj_000001 is not water tight or has incorrect normals. If that is the case, consider setting skip_inside_check to True. It took 12 tries to place obj_000001 It took 1 tries to place obj_000009 It took 1 tries to place obj_000006 " although the rendered picture includes both target and distractor object, this warning made it extremely time-consuming. I have tried to modify blenderproc.python.utility.CollisionUtility.CollisionUtility.check_mesh_intersection, and changed "skip_inside_check" to True, but it doesn't work. I still encounter the same warning. What should I do. Thanks a lot.

Minimal code example

# Sample object poses and check collisions
    bproc.object.sample_poses(objects_to_sample=sampled_target_bop_objs,
                              sample_pose_func=sample_pose_func,
                              max_tries=1000)
    bproc.object.sample_poses(objects_to_sample=sampled_distractor_bop_objs,
                              sample_pose_func=sample_pose_func2,
                              max_tries=1000)

    @staticmethod
    def check_mesh_intersection(obj1: MeshObject, obj2: MeshObject, skip_inside_check: bool = True,
                                bvh_cache: Optional[Dict[str, mathutils.bvhtree.BVHTree]] = None) \
            -> Tuple[bool, Dict[str, mathutils.bvhtree.BVHTree]]:

Files required to run the code

main_boat_random.py ObjectPoseSampler.py CollisionUtility.py

Expected behavior

52ae4a4bfc9ce958ea447e545e58f30

BlenderProc version

3.3.1

cornerfarmer commented 3 months ago

If you set skip_inside_check to True here:

https://github.com/DLR-RM/BlenderProc/blob/610aa3fceea748e2424db7285733508e45a17113/blenderproc/python/utility/CollisionUtility.py#L48

then the inside check should be skipped.

However, I am not sure the inside check really is so time intensive. Did you do some preformance profiling? Also the inside check has its reason, otherwise objects might be placed inside each other.

bb0928 commented 3 months ago

Thanks for your reply. I can avoid those circumstances simply by setting skip_inside_check to True.