Skip to content

Tendon/Muscle Rendering in Brax Visualizer #581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ttktjmt opened this issue Mar 5, 2025 · 4 comments
Open

Tendon/Muscle Rendering in Brax Visualizer #581

ttktjmt opened this issue Mar 5, 2025 · 4 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@ttktjmt
Copy link

ttktjmt commented Mar 5, 2025

Hello brax team,

I am exploring the integration of musculoskeletal model simulations using myosuite with brax, and I would like to see tendon and muscle features within the brax simulation system. Although brax now supports tendons and muscles on the backend via MJX compatibility, the visualization (for example, through the brax.io.html.render function) does not display tendons.

Issue

As I investigated the root cause of this problem, it seems that tendons are not currently implemented in the System class in brax/base.py and I cannot refer to them as objects from JavaScript files in brax/visualizer/js/*.js, which presumably contributes to this limitation. There may be other parts of the system that require modification as well.

I found this issue #149 really close to my request, but it is not active, probably because brax supported mjx and tendon was supported in the backend.

Request

Would it be possible to add this feature in development as a new feature for brax? It would significantly improve the visualization aspect of the simulation for researchers and developers working with musculoskeletal models.

If integrating this feature internally is not feasible at the moment, could you please advise on which files beyond brax/base.py and the visualization scripts in brax/visualizer/js/*.js would need modification for comprehensive tendon support?

Planned Implementation

  • Visualize tendons as capsules, or with spheres at each node and a cylinder for the path (like mujocoUtils.js#L469-L483 and main.js#L221-L251 in mujoco_wasm)
  • Display tendons in red color, with the color intensity/strength changing based on the activation strength of the attached muscle actuator.

Thank you in advance for considering this feature request.

@InckieUltra
Copy link

Will mujoco renderer work for you? Here is the example I found:
https://github.com/google-deepmind/mujoco/blob/main/mjx/mujoco/mjx/viewer.py

@ttktjmt
Copy link
Author

ttktjmt commented Mar 10, 2025

Hello @InckieUltra, Thank you for the comment.
I should have clarified this up front, but my primary objective is to build an interactive browser-based visualizer using Three.js, similar to what's discussed in issue #107.

I noticed that tendons/muscles are technically supported in the brax System class and accessible via its parent class's (mjx.Model) attributes, so I think I only need to visualize it with the brax html visualizer.

@ttktjmt ttktjmt changed the title Tendon/Muscle Support in Brax System Tendon/Muscle Rendering in Brax Visualizer Mar 10, 2025
@btaba
Copy link
Collaborator

btaba commented Apr 7, 2025

Hi @ttktjmt , we aren't actively developing the brax visualizer anymore. If you'd like to submit a PR, you're more than welcome but we advise to use the MuJoCo renderer when possible.

@btaba btaba closed this as completed Apr 7, 2025
@btaba btaba reopened this Apr 7, 2025
@btaba btaba added the enhancement New feature or request label Apr 7, 2025
@btaba btaba added the wontfix This will not be worked on label Apr 11, 2025
@btaba
Copy link
Collaborator

btaba commented Apr 11, 2025

Hi @ttktjmt , set the issue to "won't fix" but if someone wants to take a look, please feel free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants