# Bind texture with no repeat (zero)

**URL:** <https://discourse.threejs.org/t/bind-texture-with-no-repeat-zero/25737>\
**Category:** Questions\
**Tags:** textures\
**Created:** [April 27, 2021, 6:51am UTC](https://discourse.threejs.org/t/bind-texture-with-no-repeat-zero/25737 "2021-04-27T06:51:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johnatan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/johnatan/32/15204_2.png) [@Johnatan](https://discourse.threejs.org/u/Johnatan)\
**Post date:** [April 27, 2021, 6:51am UTC](https://discourse.threejs.org/t/bind-texture-with-no-repeat-zero/25737/1 "2021-04-27T06:51:20Z")

</div>

I’m trying to pass a texture to my shader with no wrapping (zero). So I load my tex like this:

`import tex0 from "./img/tec.jpg";`

and then I pass the texture as a uniform:

`tex0: { value: new THREE.TextureLoader().load(tex0) }`

This is working, but how would I set no repeat in this case?

I can only find examples where the texture wraps are set outside the uniform structure. I have already tried that, but unfortunately, the texture no longer comes across.

So if I include the sample code from [three.js docs](https://threejs.org/docs/index.html#api/en/textures/Texture) and then pass the texture to the shader, it is no longer included.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [April 27, 2021, 7:47am UTC](https://discourse.threejs.org/t/bind-texture-with-no-repeat-zero/25737/2 "2021-04-27T07:47:08Z")

</div>

> [@Johnatan](#):
>
> So if I include the sample code from [three.js docs](https://threejs.org/docs/index.html#api/en/textures/Texture) and then pass the texture to the shader, it is no longer included.

This is strange since this approach should definitely work. And you need it if you want to change texture properties.

> [@Johnatan](#):
>
> This is working, but how would I set no repeat in this case?

The default value of `wrapS` and `wrapT` is `ClampToEdgeWrapping`. Not `RepeatWrapping`. I’m a bit irritated why you see a texture repetition although you don’t change the default values.

---

<div class="post-metadata">

**Author:** ![Johnatan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/johnatan/32/15204_2.png) [@Johnatan](https://discourse.threejs.org/u/Johnatan)\
**Post date:** [May 1, 2021, 8:09am UTC](https://discourse.threejs.org/t/bind-texture-with-no-repeat-zero/25737/3 "2021-05-01T08:09:14Z")

</div>

> The default value of `wrapS` and `wrapT` is `ClampToEdgeWrapping` . Not `RepeatWrapping` . I’m a bit irritated why you see a texture repetition although you don’t change the default values.

I don’t see a repetition but a hold of the texture.

I think I have a syntax problem here because I can’t load the texture. In my constructor I load the texture:

`this.contentTexture = new THREE.TextureLoader().load("./img/tec.jpg");`

and then I pass it on to the shader:

tex0: { type: “t”, value: this.contentTexture }

but the buffer is empty.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [May 1, 2021, 8:34am UTC](https://discourse.threejs.org/t/bind-texture-with-no-repeat-zero/25737/4 "2021-05-01T08:34:23Z")

</div>

If you can share this issue with a [live example](https://jsfiddle.net/f2Lommf5/), it will be easier to find out why this happens.

---

<div class="post-metadata">

**Author:** ![Johnatan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/johnatan/32/15204_2.png) [@Johnatan](https://discourse.threejs.org/u/Johnatan)\
**Post date:** [May 8, 2021, 1:52pm UTC](https://discourse.threejs.org/t/bind-texture-with-no-repeat-zero/25737/6 "2021-05-08T13:52:05Z")

</div>

I managed to set the texture properties, but I’m stuck with the same issue.  
According to the documentary, we have three modes for sampling textures:

```
With RepeatWrapping the texture will simply repeat to infinity.

ClampToEdgeWrapping is the default. The last pixel of the texture stretches to the edge of the mesh.

With MirroredRepeatWrapping the texture will repeats to infinity, mirroring on each repeat.

```

how can I sample a texture without having a hold of the last pixel?
