Open N-NEJATISHAHIDIN opened 4 years ago
Hi Negar,
the code is already getting quite out of date ;) If I would start today from scratch, I would take one of the many good Python renderers out there, e.g. pyrender
Rendering is then super simple, and you should be able to have multiple offscreen renderers with different resolutions! Something like this should work:
import cv2
import pyrender
scene = pyrender.Scene()
renderer = pyrender.OffscreenRenderer(1600, 1200)
light = pyrender.DirectionalLight(intensity=3)
# Set up the camera -- X-right, Y-up, Z-back
camera = pyrender.IntrinsicsCamera(512, 512, 800, 600)
mesh = pyrender.Mesh.from_trimesh(trimesh.Trimesh(vertices, faces))
scene.add(mesh)
color, depth = renderer.render(scene)
cv2.imshow('color', color)
cv2.waitKey()
Thank you for your prompt reply!
I am using your Renderer class for images with different height and width. So, I need to have more than one Renderer instance. Although I clear the previous renderer, I still can not build a new one with different height and width. What is your suggestion?