• Stars
    star
    135
  • Rank 269,297 (Top 6 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A set of Python utilities for rendering 3D meshes with OpenGL

meshrender

NOTE: SUPPORT FOR THIS REPOSITORY IS BEING ENDED SOON. BUT FEAR NOT, THERE IS A (MUCH BETTER) REPLACEMENT!

I've written a much better GLTF 2.0 compliant renderer that can do shadows, textures, and physically-based rendering. Check it out here: https://github.com/mmatl/pyrender

A simple, OpenGL 3+ based Python scene renderer

Build Status

This package, which is build on top of PyOpenGL, is designed to make it easy to render images of 3D scenes in pure Python. It supports a scene abstraction and allows users to specify material properties, camera intrinsics, and lighting.

Extensive API documentation is provided here, but an example of using the library to render color and depth images is shown below.

    import numpy as np
    import trimesh
    from autolab_core import RigidTransform
    from perception import CameraIntrinsics, RenderMode

    from meshrender import Scene, MaterialProperties, AmbientLight, PointLight, SceneObject, VirtualCamera

    # Start with an empty scene
    scene = Scene()

    #====================================
    # Add objects to the scene
    #====================================

    # Begin by loading meshes
    cube_mesh = trimesh.load_mesh('cube.obj')
    sphere_mesh = trimesh.load_mesh('sphere.obj')

    # Set up each object's pose in the world
    cube_pose = RigidTransform(
        rotation=np.eye(3),
        translation=np.array([0.0, 0.0, 0.0]),
        from_frame='obj',
        to_frame='world'
    )
    sphere_pose = RigidTransform(
        rotation=np.eye(3),
        translation=np.array([1.0, 1.0, 0.0]),
        from_frame='obj',
        to_frame='world'
    )

    # Set up each object's material properties
    cube_material = MaterialProperties(
        color = np.array([0.1, 0.1, 0.5]),
        k_a = 0.3,
        k_d = 1.0,
        k_s = 1.0,
        alpha = 10.0,
        smooth=False
    )
    sphere_material = MaterialProperties(
        color = np.array([0.1, 0.1, 0.5]),
        k_a = 0.3,
        k_d = 1.0,
        k_s = 1.0,
        alpha = 10.0,
        smooth=True
    )

    # Create SceneObjects for each object
    cube_obj = SceneObject(cube_mesh, cube_pose, cube_material)
    sphere_obj = SceneObject(sphere_mesh, sphere_pose, sphere_material)

    # Add the SceneObjects to the scene
    scene.add_object('cube', cube_obj)
    scene.add_object('sphere', sphere_obj)

    #====================================
    # Add lighting to the scene
    #====================================

    # Create an ambient light
    ambient = AmbientLight(
        color=np.array([1.0, 1.0, 1.0]),
        strength=1.0
    )

    # Create a point light
    point = PointLight(
        location=np.array([1.0, 2.0, 3.0]),
        color=np.array([1.0, 1.0, 1.0]),
        strength=10.0
    )

    # Add the lights to the scene
    scene.ambient_light = ambient # only one ambient light per scene
    scene.add_light('point_light_one', point)

    #====================================
    # Add a camera to the scene
    #====================================

    # Set up camera intrinsics
    ci = CameraIntrinsics(
        frame = 'camera',
        fx = 525.0,
        fy = 525.0,
        cx = 319.5,
        cy = 239.5,
        skew=0.0,
        height=480,
        width=640
    )

    # Set up the camera pose (z axis faces away from scene, x to right, y up)
    cp = RigidTransform(
        rotation = np.array([
            [0.0, 0.0, -1.0],
            [0.0, 1.0,  0.0],
            [1.0, 0.0,  0.0]
        ]),
        translation = np.array([-0.3, 0.0, 0.0]),
        from_frame='camera',
        to_frame='world'
    )

    # Create a VirtualCamera
    camera = VirtualCamera(ci, cp)

    # Add the camera to the scene
    scene.camera = camera

    #====================================
    # Render images
    #====================================

    # Render raw numpy arrays containing color and depth
    color_image_raw, depth_image_raw = scene.render(render_color=True)

    # Alternatively, just render a depth image
    depth_image_raw = scene.render(render_color=False)

    # Alternatively, collect wrapped images
    wrapped_color, wrapped_depth, wrapped_segmask = scene.wrapped_render(
        [RenderMode.COLOR, RenderMode.DEPTH, RenderMode.SEGMASK]
    )

More Repositories

1

gqcnn

Python module for GQ-CNN training and deployment with ROS integration.
Python
311
star
2

dex-net

Repository for reading the Dex-Net 2.0 HDF5 database of 3D objects, parallel-jaw grasps, and robust grasp metrics
Python
301
star
3

sd-maskrcnn

Code for SD Mask R-CNN Project
C++
213
star
4

FogROS2

An Adaptive and Extensible Platform for Cloud and Fog Robotics Using ROS 2
Python
177
star
5

rlqp

Accelerating Quadratic Optimization with Reinforcement Learning
87
star
6

autolab_core

Core utilities for Berkeley AutoLab.
Python
81
star
7

AlphaGarden

A fast, first order open-access simulator that integrates single plant growth models with inter-plant competition for sun light and water.
Python
80
star
8

perception

AUTOLab perception toolkit
Python
69
star
9

yumipy

Python control interface for interacting with the ABB YuMi Robot
Python
62
star
10

FogROS

Please see FogROS 2, which is under active development and part of ROS 2. FogROS v1 (this repo) is deprecated.
Python
49
star
11

DART

Python
47
star
12

meshpy

A 3-D triangular mesh package for Python.
Python
42
star
13

ipc-graspsim

C++
36
star
14

ifl_benchmark

Interactive Fleet Learning Benchmark
Python
36
star
15

Urban_Driving_Simulator

FLUIDS is a lightweight driving simulator for benchmarking Deep Reinforcement and Imitation learning algorithms.
Python
23
star
16

dex-nerf-datasets

Datasets for Dex-NeRF: Using a Neural Radiance field to Grasp Transparent Objects
23
star
17

HIL-MT

Multi-Task Hierarchical Imitation Learning of Robot Skills
Python
20
star
18

cloth_simulation

Classes and functions related to 3D fabric simulation
Python
20
star
19

mirage

Mirage: a zero-shot cross-embodiment policy transfer method. Benchmarking code for cross-embodiment policy transfer.
Python
15
star
20

tsc-dl

Visual Transition State Clustering
Python
13
star
21

fog_x

Jupyter Notebook
11
star
22

visualization

Visualization tools for the autolab
Python
8
star
23

RAPID

First-order agriculture simulator and datasets.
Python
8
star
24

OpenRAVE-motion-planner

Python
7
star
25

rlqp-python

Python interface for RQLP (Accelerating Quadratic Optimization with RL)
Python
6
star
26

fogros2-rt-x

Python
6
star
27

IL_ROS_HSR

For performing various learning-based tasks with ROS-based robots.
Python
5
star
28

optimal_manipulation_simulator

generate YuMi optimal manipulation via simulation in ROS for learning 3D motion and collision avoidance
Python
5
star
29

dvrkCalibration

Python
5
star
30

RobotToolChanger

Tool-changer and tool for collaborative and service robots
4
star
31

Traffic_Camera_Pipeline

Python
4
star
32

jointseg

Joint Segmentation of 3D Meshes
Python
4
star
33

FLSpegtransferHO

Python
4
star
34

rlqp_train

Environment and training for RQLP (Accelerating Quadratic Optimization with RL)
Python
3
star
35

LifelongLERFROS

Drivers for the insta360 cameras
Python
3
star
36

RAPID-MOLT

RAPID-MOLT: A Meso-Scale, Open-Source, Low-Cost, Testbed for Robot Assisted Precision Irrigation and Delivery.
Python
3
star
37

h264_image_transport

C++
3
star
38

caging

C++
3
star
39

xray

X-Ray: Mechanical Search for an Occluded Object by Minimizing Support of Learned Occupancy Distributions
Python
3
star
40

endoscope_calibration

This repository contains the scripts used to calibrate the endoscope stereoscopic cameras. It also contains scripts to test the calibration.
Python
3
star
41

IIFL

Implicit Interactive Fleet Learning
Python
3
star
42

L3GS

Jupyter Notebook
2
star
43

Orienting_Novel_3D_Objects

Orienting Novel 3D Objects Using Self-Supervised Learning of Rotation Transforms
Python
2
star
44

FETCH_CORE

Python
2
star
45

exploratory-grasping

Repo for "Exploratory Grasping: Asymptotically Optimal Algorithms for Grasping Challenging Polyhedral Objects"
Python
2
star
46

RL-experiments

Experiments for RL
Jupyter Notebook
2
star
47

bags

Website for ICRA submission on manipulating cables, fabrics, and bags.
HTML
2
star
48

dvrk-vismpc

DVRK code for VisMPC + Fabric project
Python
2
star
49

metarl

Meta RL Project
Jupyter Notebook
2
star
50

masters_control

Python
2
star
51

SkillHub

Python
2
star
52

DSDR

Distributed Spectral Dimensionality Reduction (DSDR)
Scala
2
star
53

malasakit

Malasakit is a customizable participatory assessment platform that collects and integrates quantitative assessment, qualitative feedback, and peer-to-peer collaborative filtering on ways local communities can become better prepared for typhoons and floods.
Python
2
star
54

Kit-Net

Python
2
star
55

dvrk-hierarchical-control

This package is a hierarchical control package for the Da Vinci Research Kit
Python
2
star
56

FLUIDS_IL

Imitation Learning Code for The FLUIDS Simulator
Python
2
star
57

omni_master

Code for using Phantom Omnis as master controllers
C++
2
star
58

PolyPoD

Everything I'll be working on in alphagarden prefs project
Python
2
star
59

dexnet_gui

A GUI for Dex-Net based on ROS and PyQt4
Python
2
star
60

yumirws

Python
1
star
61

nix

Shell
1
star
62

fcgqcnn

Fully-Convolutional version of GQ-CNN
CSS
1
star
63

google_goggles_project

Cloud robotics grasping project using Google Goggles
C++
1
star
64

jester

PHP
1
star
65

ur5py

Python
1
star
66

shiv

1
star
67

HierSupCASE

HTML
1
star
68

line_cutting

This repository contains scripts used for the DVRK cutting experiments.
Python
1
star
69

gym_fluids

OpenAI Gym interface to the FLUIDS simulator
Python
1
star
70

toppling

Python
1
star
71

mplambda

Motion Planning Lambdas
C++
1
star
72

fast_grasp_detect

For supporting our IL_ROS_HSR code
Python
1
star
73

query-incentive-model

Django application to collect emails over internet and run query incentive algorithm on the code
JavaScript
1
star
74

evo-nerf-datasets

corl2022
1
star
75

FLSpegtransfer

Python
1
star
76

yumiplanning

Repo for planning/IK code for the YuMi robot
Python
1
star
77

berkeleyautomation.github.io

JavaScript
1
star
78

fogros2-examples

Examples Applications With FogROS2
C++
1
star
79

legs_ros_ws

C++
1
star