DLR-RM / BlenderProc

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

I run a physics simulation twice and find that the objects in the scene have not changed #935

Closed TheIOne closed 1 year ago

TheIOne commented 1 year ago

Describe the issue

I imported the object and scene into the blender, and tried to change the position of the object through secondary simulation without changing the properties of the object in the scene, but it did not take effect。

These are the two images generated that look indistinguishable 000121 000120

Minimal code example

##load objects and initlize...
def sample_pose_func(obj: bproc.types.MeshObject):
    # min = np.random.uniform([-0.3, -0.3, 0.0], [-0.2, -0.2, 0.0])
    # max = np.random.uniform([0.2, 0.2, 0.4], [0.3, 0.3, 0.6])
    obj.set_location(np.random.uniform([-x,-y,0], [x,y,z]))
    obj.set_rotation_euler(bproc.sampler.uniformSO3())
step=2
for i in range(step):
    # Sample object poses and check collisions
   bproc.object.sample_poses(objects_to_sample=sampled_bop_objs,
                          sample_pose_func=sample_pose_func,
                          max_tries=1000)

    # Physics Positioning
    bproc.object.simulate_physics_and_fix_final_poses(min_simulation_time=3,
                                                      max_simulation_time=10,
                                                      check_object_interval=1,
                                                      substeps_per_frame=20,
                                                      solver_iters=25)

    # BVH tree used for camera obstacle checks
    bop_bvh_tree = bproc.object.create_bvh_tree_multi_objects(sampled_bop_objs)

    bproc.camera.add_camera_pose(cam2world) #camera location dont change

Files required to run the code

No response

Expected behavior

I think their posture should change a lot

BlenderProc version

v2.4.1

cornerfarmer commented 1 year ago

Hey @TheIOne,

at which point do you run the renderer? If you run the renderer in the end after the loop, it will render only the state of the objects after the final physics simulation.

TheIOne commented 1 year ago

Thanks for the reply, I really should render and save the image after each simulation!