Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Google deepmind Mujoco Filament Model Util

From Leeroopedia
Knowledge Sources
Domains Rendering, Mesh Processing
Last Updated 2026-02-15 04:00 GMT

Overview

Converts MuJoCo mesh data (vertices, normals, texcoords, convex hulls) into Filament vertex and index buffers for rendering.

Description

model_util.cc provides utility functions for translating MuJoCo model mesh representations into Filament-compatible GPU buffers. It handles both standard triangle meshes and convex hull geometry, computing face normals when the mesh-provided normals are unreliable (dot product threshold below 0.8). The FillConvexHullBuffer template function iterates over convex hull faces from the mesh_graph structure, reading vertex positions, computing orientations via CalculateOrientation, and optionally including UV texture coordinates.

Usage

Called by ObjectManager during model loading to upload mesh geometry to the GPU. Each mesh in the MuJoCo model is processed and stored as Filament vertex and index buffer pairs for efficient rendering.

Code Reference

Source Location

Key Functions

static bool UseFaceNormal(const float3& face_normal, const float3& mesh_normal);
template <typename T>
static void FillConvexHullBuffer(T* ptr, std::size_t num, const mjModel* model, int meshid);
// Mesh upload and buffer creation utilities

Import

#include "experimental/filament/filament/model_util.h"

I/O Contract

Inputs

Name Type Required Description
model const mjModel* Yes MuJoCo model containing mesh vertex, normal, texcoord, and graph data
meshid int Yes Index of the mesh to convert
engine filament::Engine* Yes Filament engine for buffer allocation

Outputs

Name Type Description
vertex_buffer filament::VertexBuffer* GPU vertex buffer with positions, normals, and UVs
index_buffer filament::IndexBuffer* GPU index buffer with triangle indices

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment