gazebosim / gazebosim/gz-rendering
Textures from different models with same base name are reused in Ogre2
- Dominant language
- C++
- Stars
- 81
- Forks
- 90
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 10
Description
The Ogre 2 plugin is using a texture's file name to uniquely identify each texture. This means that all textures called `texture.png` will be treated as the same, even if they're in different directories.
For example, all (most?) models in this collection have texture files called `texture.png`. This means that all models will use the texture from the first model. For example, load this world on `ign-gazebo`:
world.sdf
```
3D View
false
docked
ogre2
scene
1.0 1.0 1.0
0.8 0.8 0.8
-6 0 6 0 0.5 0
true
0 0 10 0 0 0
0.8 0.8 0.8 1
0.2 0.2 0.2 1
1000
0.9
0.01
0.001
-0.5 0.1 -0.9
true
0 0 1
0 0 1
100 100
0.8 0.8 0.8 1
0.8 0.8 0.8 1
0.8 0.8 0.8 1
https://fuel.ignitionrobotics.org/1.0/GoogleResearch/models/adizero_F50_TRX_FG_LEA
0 0.5 0 0 0 0
https://fuel.ignitionrobotics.org/1.0/GoogleResearch/models/adistar_boost_m
```
See how the 2nd model uses the 1st model's texture:

As a comparison, change `ogre2` to `ogre` in the world, and see that each models loads its own texture:

I believe this can be fixed by using the whole texture path instead of just the basename here:
https://github.com/ignitionrobotics/ign-rendering/blob/46bf31837a347955a483de6dab3ad45e42370666/ogre2/src/Ogre2Material.cc#L441-L443
---
If I remember correctly, this was done on purpose so that all the cave tiles on SubT use the same texture. This should be resolved by allowing models to reference each other's textures (https://github.com/ignitionrobotics/ign-gazebo/issues/343) and then doing that for all the cave tiles.
Contributor guide
Assessment
This issue has not been assessed yet.