Skip to content

Commit

Permalink
Include .glsl in simplepbr (#583)
Browse files Browse the repository at this point in the history
* include .glsl in simplepbr

* more test

* fix github CI
  • Loading branch information
QuanyiLi committed Dec 19, 2023
1 parent 126d6d0 commit de63064
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Prepare OpenGL
run: |
sudo apt-get -y install xvfb
sudo /usr/bin/Xvfb :0 -screen 0 1280x1024x24 &
- name: Blackbox tests
run: |
pip install cython
Expand Down
6 changes: 5 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ recursive-include metadrive\render_pipeline\ *

recursive-include metadrive/shaders/ *
recursive-include metadrive\\shaders\\ *
recursive-include metadrive\shaders\ *
recursive-include metadrive\shaders\ *

recursive-include metadrive/third_party/simplepbr/shaders/ *
recursive-include metadrive\\third_party\\simplepbr\\shaders\\ *
recursive-include metadrive\third_party\simplepbr\shaders\ *
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[
<a href="https://metadrive-simulator.readthedocs.io">Documentation</a>
|
<a href="https://colab.research.google.com/github/metadriverse/metadrive/blob/main/metadrive/examples/Basic_MetaDrive_Usages.ipynb">Colab Examples</a>
<a href="https://github.com/metadriverse/metadrive?tab=readme-ov-file#-examples">Colab Examples</a>
|
<a href="https://www.youtube.com/embed/3ziJPqC_-T4">Demo Video</a>
|
Expand Down
49 changes: 45 additions & 4 deletions metadrive/examples/Basic_MetaDrive_Usages.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"source": [
"# Quick Start Tutorial of the basic functionality of MetaDrive\n",
"\n",
"Welcome to try out MetaDrive!\n",
"Welcome to MetaDrive!\n",
"\n",
"MetaDrive v0.2.5 supports two running modes:\n",
"\n",
"1. **With 3D rendering functionality**: MetaDrive can easily install and run in personal computer, but may need special treatments for 3D rendering in headless machine and cloud servers.\n",
"1. **With 3D rendering functionality**: MetaDrive can easily install and run on personal computer, but may need special treatments for 3D rendering in headless machines and cloud servers.\n",
"\n",
"2. **Without 3D rendering functionality**: MetaDrive can easily install and run in any machine. In this Colab notebook, we demonstrate MetaDrive in this mode and the renderer will be the **2D** **Pygame** renderer.\n",
"2. **Without 3D rendering functionality**: MetaDrive can easily be installed and run on any machine. In this Colab notebook, we mainly demonstrate MetaDrive in this mode and the renderer will be the **2D** **Pygame** renderer.\n",
"\n",
"In this tutorial, we will navigate you through the installation and some basic functionality of MetaDrive!"
]
Expand Down Expand Up @@ -454,6 +454,47 @@
"\n",
"env.close()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3D Renderer\n",
"For using the 3D renderer, just set `use_render=True` in the environment config. Or you can turn on the `image_observation`, which will make an offscreen renderer so we can access the rendered result by capturing frames."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from metadrive.envs.metadrive_env import MetaDriveEnv\n",
"\n",
"cfg=dict(image_observation=True, \n",
" vehicle_config=dict(image_source=\"main_camera\"),\n",
" window_size=(84, 60))\n",
"\n",
"env=MetaDriveEnv(cfg)\n",
"try:\n",
" env.reset()\n",
" for _ in range(5):\n",
" env.step([0,0])\n",
" env.capture(\"3d_renderer.png\")\n",
"\n",
"finally:\n",
" env.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Image\n",
"Image(open(\"3d_renderer.png\", \"rb\").read())"
]
}
],
"metadata": {
Expand All @@ -476,7 +517,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.13"
"version": "3.9.17"
}
},
"nbformat": 4,
Expand Down

0 comments on commit de63064

Please sign in to comment.