Extend texture support #27
Open
Flova wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Mjviser
Full scene