Skip to content

Commit

Permalink
fix(DLR-RM#830): apply double-sided material for pyrender rendering i…
Browse files Browse the repository at this point in the history
…n order to render non-watertight meshes
  • Loading branch information
wboerdijk committed May 6, 2023
1 parent 14d4e1b commit 1219b78
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions blenderproc/python/writer/BopWriterUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ def write_bop(output_dir: str, target_objects: Optional[List[MeshObject]] = None
trimesh_objects = {}
for obj in dataset_objects:
trimesh_obj = obj.mesh_as_trimesh()
if m2mm:
trimesh_obj.apply_scale(scaling=0.001)
trimesh_objects[obj.get_cp('category_id')] = pyrender.Mesh.from_trimesh(mesh=trimesh_obj)
# we need to create a double-sided material to be able to render non-watertight meshes
# the other parameters are defaults, see
# https://github.com/mmatl/pyrender/blob/master/pyrender/mesh.py#L216-L223
material = pyrender.MetallicRoughnessMaterial(alphaMode='BLEND', baseColorFactor=[0.3, 0.3, 0.3, 1.0],
metallicFactor=0.2, roughnessFactor=0.8, doubleSided=True)
trimesh_objects[obj.get_cp('category_id')] = pyrender.Mesh.from_trimesh(mesh=trimesh_obj, material=material)

_BopWriterUtility.calc_gt_masks(chunk_dirs=chunk_dirs, starting_frame_id=starting_frame_id,
dataset_objects=trimesh_objects, m2mm=m2mm, delta=delta)
Expand Down

0 comments on commit 1219b78

Please sign in to comment.