渲染清晰的文本作为three.js纹理

nny*_*yby 4 javascript textures three.js

我有一个512x512 SVG,我正在这样绘制到圆形平面上

    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);
Run Code Online (Sandbox Code Playgroud)

它工作正常,但是此SVG上面有一些文字,在three.js中呈现时确实很模糊:

webgl中模糊文本的屏幕截图

如何使它尽可能清晰?

作为参考,以下是SVG呈现为512x512 png的内容:

锋利的指南针

nny*_*yby 7

…就像我决定在这里发布一样,我的问题已经解决,方法是添加 material.map.minFilter = THREE.LinearFilter;

  • 另外,请确保从窗口对象设置像素比率,例如: renderer.setPixelRatio(window.devicePixelRatio); (不要输入数字)例如,如果您有视网膜屏幕,那就更好了 (2认同)