How to use the ClampToEdgeWrapping function from three
Find comprehensive JavaScript three.ClampToEdgeWrapping code examples handpicked from public code repositorys.
three.ClampToEdgeWrapping is a type of texture wrapping mode that repeats the edge pixels of the texture if the texture coordinates exceed the boundaries.
53 54 55 56 57 58 59 60 61 62
texture.type = typedArrayToThree(config.volume.data.constructor); texture.generateMipmaps = false; texture.minFilter = THREE.LinearFilter; texture.magFilter = THREE.LinearFilter; texture.wrapT = THREE.ClampToEdgeWrapping; texture.wrapS = THREE.ClampToEdgeWrapping; texture.needsUpdate = true; const material = new THREE.ShaderMaterial({
+ 3 other calls in file
GitHub: K3D-tools/K3D-jupyter
62 63 64 65 66 67 68 69 70 71
texture.magFilter = THREE.NearestFilter; } texture.wrapS = THREE.ClampToEdgeWrapping; texture.wrapT = THREE.ClampToEdgeWrapping; texture.wrapR = THREE.ClampToEdgeWrapping; texture.needsUpdate = true; jitterTexture = new THREE.DataTexture( new Uint8Array(_.range(64 * 64).map(() => randomMul * Math.random())),
+ 9 other calls in file
How does three.ClampToEdgeWrapping work?
three.ClampToEdgeWrapping is a class in the Three.js library that specifies how textures should be wrapped or repeated when they extend beyond the edges of their container. In the case of three.ClampToEdgeWrapping, the texture is clamped to the edge of the container, meaning that any texels (texture elements) that would fall outside of the container are replaced with the color of the texels along the edge of the container.
GitHub: mattdesl/filmic-gl
138 139 140 141 142 143 144 145 146 147
var lookupTexture = THREE.ImageUtils.loadTexture("img/lookup_film.png"); lookupTexture.genMipmaps = false; lookupTexture.minFilter = THREE.LinearFilter; lookupTexture.magFilter = THREE.LinearFilter; lookupTexture.wrapS = THREE.ClampToEdgeWrapping; lookupTexture.wrapT = THREE.ClampToEdgeWrapping; var postMaterial = new THREE.ShaderMaterial({ uniforms: {
+ 3 other calls in file
GitHub: mattdesl/xmas
20 21 22 23 24 25 26 27 28 29
nrm.wrapS = nrm.wrapT = THREE.RepeatWrapping nrm.minFilter = nrm.magFilter = THREE.LinearFilter nrm.generateMipmaps = false var tex = THREE.ImageUtils.loadTexture(matCapUrl) //mcap1, mcap4 tex.wrapS = tex.wrapT = THREE.ClampToEdgeWrapping tex.minFilter = tex.magFilter = THREE.LinearFilter tex.generateMipmaps = false var mat = material(tex, nrm, reflectionCube, 1.0)
+ 3 other calls in file
Ai Example
1 2 3
const texture = new THREE.TextureLoader().load("myTexture.png"); texture.wrapS = THREE.ClampToEdgeWrapping; texture.wrapT = THREE.ClampToEdgeWrapping;
In this example, ClampToEdgeWrapping is used to specify that the texture should not repeat when the texture coordinates go outside the range of [0, 1]. Instead, the texture should be "clamped" to the edge values, which means that the color of the nearest texel is used.
80 81 82 83 84 85 86 87 88 89
texture.image.width = size; texture.image.height = size * size; texture.type = three_1.UnsignedByteType; texture.magFilter = three_1.LinearFilter; texture.minFilter = three_1.LinearFilter; texture.wrapS = three_1.ClampToEdgeWrapping; texture.wrapT = three_1.ClampToEdgeWrapping; texture.generateMipmaps = false; texture.needsUpdate = true; const texture3D = new three_1.Data3DTexture();
+ 9 other calls in file
20 21 22 23 24 25 26 27 28 29
// textures var tempMap = new THREE.DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, THREE.RGBFormat); tempMap.minFilter = THREE.NearestFilter; tempMap.magFilter = THREE.NearestFilter; tempMap.wrapS = THREE.ClampToEdgeWrapping; tempMap.wrapT = THREE.ClampToEdgeWrapping; tempMap.needsUpdate = true; var occlusionMap = new THREE.DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, THREE.RGBFormat);
+ 3 other calls in file
three.Vector3 is the most popular function in three (22341 examples)