【问题标题】:How to use a texture in the size of the original image in threejs / react-three-fiber如何在threejs / react-three-fiber中使用原始图像大小的纹理
【发布时间】:2021-03-14 21:24:26
【问题描述】:

我在一个项目中遇到困难,我需要创建一个盒子来优化处理,我希望纹理为 16 px x 16 px。当我将它应用于盒子时,无论盒子的大小如何,它都会像下图一样变得模糊。是否有可能将纹理的像素设置为与图像完全相同?不使用大图?

使用 16 x 16 像素的图像生成。

使用 500 x 16 像素的图像生成。

【问题讨论】:

标签: three.js react-three-fiber


【解决方案1】:

我设法通过在纹理上添加过滤器来解决它: 示例:

import dirtImg from './images/dirt.jpg';
export const dirt = new TextureLoader().load(dirtImg);
dirt.magFilter = NearestFilter;
dirt.minFilter = LinearMipMapLinearFilter;

【讨论】:

    猜你喜欢
    • 2021-10-05
    • 2020-07-16
    • 2020-11-08
    • 2021-12-05
    • 1970-01-01
    • 2021-08-20
    • 1970-01-01
    • 2021-11-12
    • 2021-12-08
    相关资源
    最近更新 更多