gazebosim / gazebosim/gz-rendering

Textures from different models with same base name are reused in Ogre2

Open
#139 2 comments 1 reaction 0 assignees View on GitHub
🏰 citadel 📜 blueprint 🔮 dome bug help wanted ogre2.x
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:

![image](https://user-images.githubusercontent.com/5751272/92671003-1651da00-f2ca-11ea-848e-19fc099b99ae.png)

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

![image](https://user-images.githubusercontent.com/5751272/92671344-df2ff880-f2ca-11ea-84ea-fcda14960dae.png)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.