I’m just trying something out, and I want to apply a small pixel image (10x10px) to a Plane which is 10units square.
The texture scales up correctly, but, it doesn’t retain the sharp pixel edges, which is not the look I’m going for. I tried changing the minFilter & magFilter properties, but that didn’t do it.
Thanks @Mugen87 I’d set the min & mag properties on the material, and not the canvas texture, once I’d done that it worked correctly.
Correct code for anyone else looking at this:
let material3 = new THREE.MeshBasicMaterial();
material3.map = new THREE.CanvasTexture(canvas);
material3.map.magFilter = THREE.NearestFilter;
material3.map.minFilter = THREE.NearestFilter;
The example here is for upscaling a small (pixel art) image, where the intention is that it scales to the size of the plane AND retains the sharp edges between pixels, so no smoothing.
The textures I’m working with are 20x20 to 200x200 and scale up in the way I wanted.