Skip to content

Instantly share code, notes, and snippets.

@99991
Created November 18, 2021 13:31
Show Gist options
  • Save 99991/56b00a09679db91535c5b49e230eed38 to your computer and use it in GitHub Desktop.
Save 99991/56b00a09679db91535c5b49e230eed38 to your computer and use it in GitHub Desktop.
import blenderproc as bproc
import numpy as np
bproc.init()
# Create a simple object:
obj = bproc.object.create_primitive("MONKEY")
# Create a point light next to it
light = bproc.types.Light()
light.set_location([2, -2, 0])
light.set_energy(300)
# Set the camera to be in front of the object
cam_pose = bproc.math.build_transformation_mat([0, -5, 0], [np.pi / 2, 0, 0])
bproc.camera.add_camera_pose(cam_pose)
# Render the scene
data = bproc.renderer.render()
# Write the rendering into an hdf5 file
bproc.writer.write_hdf5("output/", data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment