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 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.
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.
1 Like
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.
If you can share this issue with a live example, it will be easier to find out why this happens.
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?