# Why does 2nd texture use first SVG?

**URL:** <https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975>\
**Category:** Questions\
**Created:** [September 21, 2021, 1:35am UTC](https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975 "2021-09-21T01:35:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [September 21, 2021, 1:35am UTC](https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975/1 "2021-09-21T01:35:47Z")

</div>

In this [Babylon.js Playground](https://playground.babylonjs.com/#LRFZVS) there are 2 SVG-based textures setup, one red and one blue, but the resulting materials both use the first SVG-based texture. Why is that? How can this playground be modified to show the blue SVG-based texture on the right instead of the red one?

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [September 21, 2021, 2:03am UTC](https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975/2 "2021-09-21T02:03:10Z")

</div>

Giving each texture a unique name works …  
[https://playground.babylonjs.com/#LRFZVS#1](https://playground.babylonjs.com/#LRFZVS#1)

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [September 21, 2021, 2:06am UTC](https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975/3 "2021-09-21T02:06:23Z")

</div>

Oh wow, thanks. I wouldn’t have thought of that. I didn’t realize the names were significant.

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [September 21, 2021, 2:09am UTC](https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975/4 "2021-09-21T02:09:34Z")

</div>

I don’t think names are usually significant (I’d need to check), but maybe there’s something else going on in this svg case that someone else maybe able to shed light on?

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [September 21, 2021, 2:31am UTC](https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975/5 "2021-09-21T02:31:15Z")

</div>

Just checked the codebase and I see what’s happening now. For image textures the `url` becomes the `name` and is used for caching. But when using `Texture.LoadFromDataString` there is no url and if the name is left blank, the texture ends up with the name `"data:"` so if there are multiple textures created from data strings without names, the first texture is always retrieved from cache as they have the same name.

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [September 21, 2021, 2:33am UTC](https://forum.babylonjs.com/t/why-does-2nd-texture-use-first-svg/23975/6 "2021-09-21T02:33:08Z")

</div>

Ya, makes sense. Thanks
