Migrate filament header documentation to docs.
PiperOrigin-RevId: 948294877 Change-Id: I6e110bbdc4d2e329a243f1b96d560698174de26b
This commit is contained in:
committed by
Copybara-Service
parent
b60609d2a1
commit
1e85ce176f
+18
-30
@@ -22,21 +22,22 @@ Parser
|
||||
Compiler
|
||||
The compiler is written in C++. It takes an mjCModel C++ object constructed by the parser, and converts it into an
|
||||
mjModel C structure used at runtime.
|
||||
Abstract visualizer
|
||||
The abstract visualizer is written in C. It generates a list of abstract geometric entities representing the
|
||||
simulation state, with all information needed for actual rendering. It also provides abstract mouse hooks for camera
|
||||
and perturbation control.
|
||||
OpenGL renderer
|
||||
The renderer is written in C and is based on fixed-function OpenGL. It does not have all the features of
|
||||
state-of-the-art rendering engines (and can be replaced with such an engine if desired) but nevertheless it provides
|
||||
efficient and informative 3D rendering.
|
||||
Thread
|
||||
The threading framework is written in C++ and exposed in C. It provides a thread pool interface
|
||||
to process tasks asynchronously. To enable use in MuJoCo, call ``mju_threadpool``.
|
||||
Rendering
|
||||
There are two rendering libraries provided by MuJoCo. The :ref:`classic rendering<OpenGLrendering>` library is
|
||||
written in C and uses OpenGL 1.5. It provides a simple and efficient way to visualize MuJoCo models. The
|
||||
:ref:`filament rendering<FilamentRendering>` library is written in C++ and uses the externally-devloped Filament
|
||||
rendering engine. It provides more modern and feature-rich real-time rendering capabilities.
|
||||
Abstract visualizer
|
||||
The abstract visualizer is written in C. It generates a list of abstract geometric entities representing the
|
||||
simulation state, with all information needed for rendering with the Classic renderer. It also provides abstract
|
||||
mouse hooks for camera and perturbation control.
|
||||
UI framework
|
||||
The UI framework is written in C. UI elements are rendered in OpenGL. It has its own event
|
||||
mechanism and abstract hooks for keyboard and mouse input. The code samples use it with GLFW, but it can also be used
|
||||
with other window libraries.
|
||||
The UI framework is written in C and is designed to work with the :ref:`classic OpenGL renderer<OpenGLrendering>`.
|
||||
UI elements are rendered in OpenGL. It has its own event mechanism and abstract hooks for keyboard and mouse input.
|
||||
The code samples use it with GLFW, but it can also be used with other window libraries.
|
||||
|
||||
.. _inStart:
|
||||
|
||||
@@ -236,14 +237,16 @@ to which the symbol belongs. First we list the prefixes corresponding to type de
|
||||
Primitive type, for example :ref:`mjtNum` and :ref:`mjtGeom`. Most types in this family are enums.
|
||||
``mjf``
|
||||
Callback function type, for example :ref:`mjfGeneric`.
|
||||
``mjs``
|
||||
Data structure related to :doc:`procedural model editing <modeledit>`, for example :ref:`mjsJoint`.
|
||||
``mjv``
|
||||
Data structure related to abstract visualization, for example :ref:`mjvCamera`.
|
||||
``mjrf``
|
||||
Data structure related to filament rendering, for example :ref:`mjrfContext`.
|
||||
``mjr``
|
||||
Data structure related to OpenGL rendering, for example :ref:`mjrContext`.
|
||||
``mjui``
|
||||
Data structure related to UI framework, for example :ref:`mjuiSection`.
|
||||
``mjs``
|
||||
Data structure related to :doc:`procedural model editing <modeledit>`, for example :ref:`mjsJoint`.
|
||||
|
||||
Next we list the prefixes corresponding to function definitions. Note that function prefixes always end with underscore.
|
||||
|
||||
@@ -256,6 +259,8 @@ Next we list the prefixes corresponding to function definitions. Note that funct
|
||||
in the sense that they do not have mjModel and mjData pointers as their arguments.
|
||||
``mjv_``
|
||||
Function related to abstract visualization, for example :ref:`mjv_updateScene`.
|
||||
``mjrf_``
|
||||
Function related to filament rendering, for example :ref:`mjrf_render`.
|
||||
``mjr_``
|
||||
Function related to OpenGL rendering, for example :ref:`mjr_render`.
|
||||
``mjui_``
|
||||
@@ -268,23 +273,6 @@ Next we list the prefixes corresponding to function definitions. Note that funct
|
||||
``mjs_``
|
||||
Functions for :doc:`procedural model editing <modeledit>`, for example :ref:`mjs_addJoint`.
|
||||
|
||||
.. _inOpenGL:
|
||||
|
||||
Using OpenGL
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The use of MuJoCo's native OpenGL renderer will be explained in :ref:`Rendering`. For rendering, MuJoCo uses OpenGL 1.5
|
||||
in the compatibility profile with the ``ARB_framebuffer_object`` and ``ARB_vertex_buffer_object`` extensions. OpenGL
|
||||
symbols are loaded via `GLAD <https://github.com/Dav1dde/glad>`_ the first time the :ref:`mjr_makeContext` function
|
||||
is called. This means that the MuJoCo library itself does not have an explicit dependency on OpenGL and can be used
|
||||
on systems without OpenGL support, as long as ``mjr_`` functions are not called.
|
||||
|
||||
Applications that use MuJoCo's built-in rendering functionalities are responsible for linking against an appropriate
|
||||
OpenGL context creation library and for ensuring that there is an OpenGL context that is made current on the running
|
||||
thread. On Windows and macOS, there is a canonical OpenGL library provided by the operating system. On Linux, MuJoCo
|
||||
currently supports GLX for rendering to an X11 window, OSMesa for headless software rendering, and EGL for hardware
|
||||
accelerated headless rendering.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
Visualization
|
||||
-------------
|
||||
|
||||
.. admonition:: MuJoCo Studio
|
||||
:class: note
|
||||
|
||||
We are actively developing a new visualizer platform called
|
||||
`MuJoCo Studio <https://github.com/google-deepmind/mujoco/blob/main/src/experimental/studio>`__. We will update this
|
||||
section once it becomes more established.
|
||||
|
||||
MuJoCo has a native 3D visualizer. Its use is illustrated in the :ref:`simulate.cc <saSimulate>` code sample and in
|
||||
the simpler :ref:`basic.cc <saBasic>` code sample. While it is not a full-featured rendering engine, it is a
|
||||
convenient, efficient and reasonably good-looking visualizer that facilitates research and development. It renders not
|
||||
@@ -303,6 +310,23 @@ OpenGL Rendering
|
||||
This stage takes the mjvScene data structure populated in the abstract visualization stage, and renders it. It also
|
||||
provides basic 2D drawing and framebuffer access, so that most applications would not need to call OpenGL directly.
|
||||
|
||||
.. _reOpenGL:
|
||||
|
||||
Using OpenGL
|
||||
'''''''''''''
|
||||
|
||||
MuJoCo uses OpenGL 1.5 in the compatibility profile with the ``ARB_framebuffer_object`` and ``ARB_vertex_buffer_object``
|
||||
extensions. OpenGL symbols are loaded via `GLAD <https://github.com/Dav1dde/glad>`_ the first time the
|
||||
:ref:`mjr_makeContext` function is called. This means that the MuJoCo library itself does not have an explicit
|
||||
dependency on OpenGL and can be used on systems without OpenGL support, as long as ``mjr_`` functions are not called.
|
||||
|
||||
Applications that use MuJoCo's built-in rendering functionalities are responsible for linking against an appropriate
|
||||
OpenGL context creation library and for ensuring that there is an OpenGL context that is made current on the running
|
||||
thread. On Windows and macOS, there is a canonical OpenGL library provided by the operating system. On Linux, MuJoCo
|
||||
currently supports GLX for rendering to an X11 window, OSMesa for headless software rendering, and EGL for hardware
|
||||
accelerated headless rendering.
|
||||
|
||||
|
||||
.. _reContext:
|
||||
|
||||
Context and GPU resources
|
||||
@@ -462,3 +486,21 @@ We also provide the functions :ref:`mjr_finish` and :ref:`mjr_getError` for expl
|
||||
for OpenGL error checking. They simply call glFinish and glGetError internally. This together with the basic 2d
|
||||
drawing functions above is meant to provide enough functionality so that most users will not need to write OpenGL
|
||||
code. Of course we cannot achieve this in all cases, short of providing wrappers for all of OpenGL.
|
||||
|
||||
|
||||
.. _FilamentRendering:
|
||||
|
||||
Filament Rendering
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
MuJoCo also provides a `Filament <https://github.com/google/filament>`_ based renderer for 3D visualization of its
|
||||
simulations.
|
||||
|
||||
Filament is a real-time physically based rendering (PBR) engine developed by Google. It is designed to be as small as
|
||||
possible and as efficient as possible, while still providing high-quality results. It works across all major platforms
|
||||
(Linux, Windows, macOS, Android, iOS, Web) and supports OpenGL, Vulkan, and Metal.
|
||||
|
||||
MuJoCo's current integration with the Filament renderer is done by setting `MUJOCO_USE_FILAMENT` to 1 in the CMake Build
|
||||
configuration. This effectively replaces the OpenGL-based `mjr` function implementations with Filament-based ones. It
|
||||
also makes the underlying Filament `mjrf` :ref:`types <tyFilamentRenderStructure>` and
|
||||
:ref:`functions <FilamentRenderingApi>` available for use.
|
||||
|
||||
Reference in New Issue
Block a user