DLR-RM / BlenderProc

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

Non-exist object appears in the rendered image in Front3D. #1144

Open wzcai99 opened 3 months ago

wzcai99 commented 3 months ago

Describe the issue

Hi, I am following the examples rendering the front-3d dataset. But when I set a camera trajectory, I find a non-exist object shown in the pointcloud of the scene. I don't know what is happening here. I use the scene ""e29c9cea-a331-4062-8d95-17f3f7ed8813.json" and visualize the pointcloud by translate every object of loaded_objects into a Trimesh() and use open3d to visualize the point cloud. image And when I follow this trajectory to get the rendered image, I found a sofa, which is not appeared on the point cloud. image That cause the observed image become black like this. image

Minimal code example

scene_pcd = o3d.geometry.PointCloud()
floor_heights = []
for obj in loaded_objects:
    if not isinstance(obj,bproc.types.MeshObject):
        continue
    category = mapping.label_from_id(obj.get_cp('category_id'))
    obj_mesh = obj.mesh_as_trimesh().apply_transform(obj.get_local2world_mat())
    new_mesh = o3d.geometry.TriangleMesh()
    new_mesh.vertices = o3d.utility.Vector3dVector(obj_mesh.vertices)
    new_mesh.triangles = o3d.utility.Vector3iVector(obj_mesh.faces)
    new_mesh.vertex_normals = o3d.utility.Vector3dVector(obj_mesh.vertex_normals)
    new_pcd = new_mesh.sample_points_uniformly(1000000)
    new_pcd = new_pcd.voxel_down_sample(0.05)
    new_pcd.colors = o3d.utility.Vector3dVector(np.ones_like(np.array(new_pcd.points)) * 0.4)
    scene_pcd = scene_pcd + new_pcd
    scene_pcd = scene_pcd.voxel_down_sample(0.05)
    if 'floor' in category:
        if len(floor_heights) == 0:
            floor_heights.append(np.array(new_pcd.points)[:,2].mean())
        else:
            distance = np.array(floor_heights) - np.array(new_pcd.points)[:,2].mean()
            if np.min(distance) > 1.0:
                floor_heights.append(np.array(new_pcd.points)[:,2].mean())

Files required to run the code

No response

Expected behavior

How does this happen?

BlenderProc version

Github main branch

cornerfarmer commented 2 months ago

Sorry for the late response. Have you tried looking at the scene in blenderprocs debug mode? Maybe there is an object which is marked hidden.