Allow textures to be randomized without rebuilding render context - #3387
copybara-service[bot] merged 3 commits into
Conversation
…nline via mjmodel
|
This feature is already supported natively by the |
|
Sure, but I'm curious why this doesn't work for the classic renderer. Are you saying that mjr_uploadTexture doesn't work? Or that it is insufficient for what you're trying to do? If the latter, can you explain your goals in more detail? |
For context domain randomization in mjlab currently works by randomizing scalar/integer fields in mjmodel. For everything except texid (and texrepeat, texuniform) this works great, even for visual randomizations, because the viewers pick those changes up. The reason The other reason to make this change in the OpenGL renderer is because it's commonly used (via Worth noting this isn't really a new feature per se on the OpenGL API. The scalar material fields ( If it helps, I'm not proposing active development on the OpenGL renderer beyond this one change. If you're firm on no changes to the OpenGL renderer I'm happy to defer but it would be a nice quality of life improvement for debugging texturing randomization in mjlab. |
|
That makes sense. In that case, I'd suggest a much simpler implementation. For starters, let's not remove any existing functionality (i.e. do not remove any fields from mjrContext). Then, simply add the new fields to mjvGeom, but give them invalid sentinel values in mjv_initGeom. Finally, in render_gl3, just check to see if those fields have non-default values and, if so, use them instead of the material values. @yuvaltassa Thoughts? |
|
I agree with @haroonq , you can do this in a non breaking way |
|
Thanks for the feedback! I've narrowed the implementation per @haroonq's comment |
|
Thanks! Can you apply a similar change to UpdateGeomMaterial in src/experimental/filament/compat/scene_geom_util.cc? |
b75470a
into
google-deepmind:main
This PR is motivated by work adding material and texture randomization to mjlab. I noticed while working on that that randomizing textures via mjmodel worked in the warp renderer but not the classic mujoco renderer. It turns out that it's trivial to enable this behavior and make the renderers more consistent by moving some cached texture fields to mjvGeom with no performance penalty at the cost of a minor ABI break.