You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to render a sphere with a non-reflective black material using pyrender. Despite configuring the material properties to create a non-reflective material (base color factor, metallic factor, and roughness factor), the sphere is not appearing black in the rendered image.
Here is the code snippet that reproduces the issue:
importpyrenderfromPILimportImageimporttrimeshimportnumpyasnp# Create a scenescene=pyrender.Scene(bg_color=[0.0, 0.0, 0.0, 1.0])
# Create a non-reflective material: black color, no metallic, high roughnessmaterial=pyrender.MetallicRoughnessMaterial(
baseColorFactor=(0.0, 0.0, 0.0, 1.0),
metallicFactor=0.0,
roughnessFactor=1.0
)
# Create a sphere mesh using trimeshsphere_trimesh=trimesh.creation.icosphere(radius=1.0, subdivisions=3)
# Convert the trimesh object to a pyrender meshsphere_mesh=pyrender.Mesh.from_trimesh(sphere_trimesh, material=material)
# Add the mesh to the scenescene.add(sphere_mesh)
# Create a light source and add it to the scenelight=pyrender.DirectionalLight(color=[1.0, 1.0, 1.0], intensity=10.0)
light_node=pyrender.Node(light=light, translation=[0, 3, -3])
scene.add_node(light_node)
# Create an orthographic camera with the calculated frustum sizecamera=pyrender.OrthographicCamera(xmag=1, ymag=1)
# Set up a camera pose to center the mesh in the framecamera_pose=np.array([
[1.0, 0.0, 0.0, 0.0], # Centering the mesh in the x-axis
[0.0, 1.0, 0.0, 0.0], # Centering the mesh in the y-axis
[0.0, 0.0, 1.0, 5.0], # Placing the camera a reasonable distance away in the z-axis
[0.0, 0.0, 0.0, 1.0]
])
scene.add(camera, pose=camera_pose)
osmesa=pyrender.OffscreenRenderer(512,512)
color, depth=osmesa.render(scene)
# Save the rendered imagerendered_image=Image.fromarray(color)
rendered_image.save(f'sphere.jpg')
osmesa.delete()
Expected Result:
The sphere should appear black in the rendered image, given the non-reflective material properties (0.0 for base color and metallic factor, and 1.0 for roughness).
Actual Result:
The sphere does not appear black in the rendered image, indicating it is still reflecting some light.
Environment:
pyrender version: 0.1.45
OS: Linux
trimesh version: 3.23.5
I would appreciate any guidance or suggestions to achieve the desired result. Thank you!
The text was updated successfully, but these errors were encountered:
Description:
I am attempting to render a sphere with a non-reflective black material using pyrender. Despite configuring the material properties to create a non-reflective material (base color factor, metallic factor, and roughness factor), the sphere is not appearing black in the rendered image.
Here is the code snippet that reproduces the issue:
Expected Result:
The sphere should appear black in the rendered image, given the non-reflective material properties (0.0 for base color and metallic factor, and 1.0 for roughness).
Actual Result:
The sphere does not appear black in the rendered image, indicating it is still reflecting some light.
Environment:
pyrender version: 0.1.45
OS: Linux
trimesh version: 3.23.5
I would appreciate any guidance or suggestions to achieve the desired result. Thank you!
The text was updated successfully, but these errors were encountered: