Skip to content

Extend texture support #27

Open
Flova wants to merge 1 commit into
mujocolab:mainfrom
Flova:texture-support
Open

Extend texture support #27
Flova wants to merge 1 commit into
mujocolab:mainfrom
Flova:texture-support

Conversation

@Flova

@Flova Flova commented Jun 14, 2026

Copy link
Copy Markdown

Primarily renders 2D plane textures and cube maps on spheres/ellipsoids.

Plane geoms with a 2D material texture now render as a textured, double-sided quad whose UVs follow MuJoCo's texrepeat/texuniform semantics, instead of only the flat infinite grid. Untextured planes still render as the infinite reference grid; textured planes are routed through the mesh path in ViserMujocoScene._add_fixed_geometry.

Spheres and ellipsoids with a cube map are sampled per the OpenGL cube-map spec MuJoCo uses for a geom (regular) cube texture (texcoords = geom-local position, faces stored right/left/up/down/front/back on +X/-X/+Y/-Y/+Z/-Z), baked into an equirectangular image and UV-mapped onto a lat-long sphere. Ellipsoids sample by their scaled local position to match MuJoCo. The cube-map box renderer shares the same per-face (s,t) math so box and sphere stay consistent; verified against MuJoCo's own EGL render.

Translucent untextured geoms are split by color in group_geoms_by_visual_compat and given a PBR alphaMode=BLEND material, since trimesh exports per-vertex alpha as opaque.

Example

Original

mj_iso

Mjviser

Screenshot_20260614_181421_Chrome

Full scene

Screenshot_20260614_133053_Chrome

Adds texture support to the scene rendering layer.

Plane geoms with a 2D material texture now render as a textured, double-sided quad whose UVs follow MuJoCo's texrepeat/texuniform semantics, instead of only the flat infinite grid. Untextured planes still render as the infinite reference grid; textured planes are routed through the mesh path in ViserMujocoScene._add_fixed_geometry. Infinite planes (size 0) fall back to a finite 20x20 textured quad.

Spheres and ellipsoids with a cube map are sampled per the OpenGL cube-map spec MuJoCo uses for a geom (regular) cube texture (texcoords = geom-local position, faces stored right/left/up/down/front/back on +X/-X/+Y/-Y/+Z/-Z), baked into an equirectangular image and UV-mapped onto a lat-long sphere. Ellipsoids sample by their scaled local position to match MuJoCo. The cube-map box renderer shares the same per-face (s,t) math so box and sphere stay consistent; verified against MuJoCo's own EGL render.

Translucent untextured geoms are split by color in group_geoms_by_visual_compat and given a PBR alphaMode=BLEND material, since trimesh exports per-vertex alpha as opaque.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant