# Multi-texture Sprite example (SOLVED)

**URL:** <https://forum.defold.com/t/multi-texture-sprite-example-solved/79554>\
**Category:** Questions\
**Created:** [January 25, 2025, 5:24pm UTC](https://forum.defold.com/t/multi-texture-sprite-example-solved/79554 "2025-01-25T17:24:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [January 25, 2025, 5:24pm UTC](https://forum.defold.com/t/multi-texture-sprite-example-solved/79554/1 "2025-01-25T17:24:15Z")

</div>

What is missing in this project to be able to use the multi-texture feature?

I prepared a small project:  
[MultiTextureSprite.zip](https://forum.defold.com/uploads/short-url/eg08MpgMOSaeOyGd0eprz8tP4gx.zip) (31.2 KB)

I have a sprite with material that has 3 samplers:

 ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/5/0/5093b2c606977c8746f4c56480ee2c955df7a042.png)

Atlases are prepared according to documentation, e.g. rename patterns are provided:

 ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/f/b/fb7cbd64bf97196bf8cca5573a722a3563729fbe.png) ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/5/8/580409334a62d00bd0de9c24cced7bfa22e57db0.png) ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/8/f/8f63438126e4de372f50de214c75eb72e9c334f8.png)

And a very simple Fragment Program:

```glsl
varying mediump vec2 var_texcoord0;

uniform lowp sampler2D albedo;
uniform lowp sampler2D normalmap;
uniform lowp sampler2D heightmap;
uniform lowp vec4 tint;

void main()
{
    // Pre-multiply alpha since all runtime textures already are
    lowp vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
    lowp vec4 albedo_color = texture2D(albedo, var_texcoord0.xy);
    lowp vec4 normal_color = texture2D(normalmap, var_texcoord0.xy);
    lowp vec4 height_color = texture2D(heightmap, var_texcoord0.xy);
    normal_color.x = 1.0;
    normal_color.y = 1.0;
    normal_color.z = 1.0;
    height_color.x = 1.0;
    height_color.y = 1.0;
    height_color.z = 1.0;
    gl_FragColor = albedo_color * normal_color * height_color * tint_pm;
}

```

But nothing is visible in the main.collection nor when running it:

 ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/7/7/77b90d6ccd555b8415ea9283857c3bf1431cd493.png)

---

<div class="post-metadata">

**Author:** ![MasterMind](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mastermind/32/31839_2.png) [@MasterMind](https://forum.defold.com/u/MasterMind)\
**Post date:** [January 26, 2025, 12:54am UTC](https://forum.defold.com/t/multi-texture-sprite-example-solved/79554/2 "2025-01-26T00:54:52Z")

</div>

Looks like you may be missing an underscore in the rename patterns. `_pattern_=`

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [January 26, 2025, 1:04am UTC](https://forum.defold.com/t/multi-texture-sprite-example-solved/79554/3 "2025-01-26T01:04:13Z")

</div>

Sadly, it’s not an issue ☹

I think the documentation is correct there, because in the example they replace from the middle of the name, e.g.: `frame_normal_1.png`, so to make it `fame1.png` they used `_normal_` pattern to be replaced with nothing.

Analogically, in my case images are named `platform_normal.png`, so to make `platform.png` I use `_normal` pattern to be replaced with nothing.

So `_` is the actual sign to be replaced.

EDIT:

Plus in Editor - when you set a correct rename pattern, you see the change in Outline:

Correct (name of image is “platform”) vs incorrect (name of image is “platform\_heightmap”, because of typo in Rename Pattern):

 ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/3/2/32abb9441b71059d5e34bce25a41d4e0db2e6d0d.png) ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/3/d/3d85495d33464faa728a66480b64c88222ad16c9.png)

---

<div class="post-metadata">

**Author:** ![MasterMind](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mastermind/32/31839_2.png) [@MasterMind](https://forum.defold.com/u/MasterMind)\
**Post date:** [January 26, 2025, 1:35am UTC](https://forum.defold.com/t/multi-texture-sprite-example-solved/79554/4 "2025-01-26T01:35:45Z")

</div>

Yup you are right ! I took a quick look and tint seems to be the problem here, changing it to a positive value will show your results and you may want to bring the go with with sprite into view a little more as it is sitting in the bottom left corner.

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [January 26, 2025, 1:39am UTC](https://forum.defold.com/t/multi-texture-sprite-example-solved/79554/5 "2025-01-26T01:39:37Z")

</div>

> [@MasterMind](#):
>
> tint seems to be the problem here, changing it to a positive value will show your results

Yes! Thank you for spotting it ❤

Indeed, I forgot to change the default 0,0,0,0. When I set it to 1,1,1,1, everything is correct 😉  
 ![obraz](https://forum-defold.b-cdn.net/uploads/default/original/3X/2/6/266396257a0a709b5f0a4fd727bf138f179ce87c.png)
