Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering sharp text as a three.js texture

I have a 512x512 SVG i'm drawing to a circular plane like this

    const texture = new THREE.TextureLoader().load('img/plane.svg');
​
    const material = new THREE.MeshBasicMaterial({
        transparent: true,
        map: texture,
        side: THREE.DoubleSide
    });
    const geometry = new THREE.CircleGeometry(5, 64);
    const plane = new THREE.Mesh(geometry, material);
    plane.rotation.x = -1;
    scene.add(plane);

It's working fine, but this SVG has some text on it and it's really blurry when rendered in three.js:

screenshot of blurry text in webgl

How do I make this as sharp as possible?

For reference, here's the SVG rendered as a 512x512 png:

sharp compass

like image 207
nnyby Avatar asked Jul 18 '18 20:07

nnyby


1 Answers

… And just as I decide to post here I solved my issue, by adding material.map.minFilter = THREE.LinearFilter;

like image 52
nnyby Avatar answered Oct 29 '22 04:10

nnyby