c++ - direct3d9 如何为像素艺术过滤纹理

标签 c++ directx pixel direct3d9

你好我想让像素艺术图像看起来不那么模糊我尝试设置采样器状态但我看不出有什么区别

device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);

enter image description here

我几乎尝试了 setsamplerstate 中的所有内容,但我看不出有任何区别

我知道我可以使用 photoshop 将照片放大,但我可以使用 direct3d9 使其看起来更硬吗

最佳答案

“像素艺术”通常是在没有任何混合或双线性过滤的情况下绘制的。对于旧版 Direct3D 9,您将使用(假设您的纹理绑定(bind)到插槽 0):

device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);

At this point, you shouldn't use legacy Direct3D 9 at all. Direct3D 11 is your best bet. If you are using C++, take a look at the SpriteBatch class with the CommonStates::PointClamp() sampler state in the DirectX Tool Kit.

关于c++ - direct3d9 如何为像素艺术过滤纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58179313/

相关文章:

python-3.x - 如何使用opencv多次更改图像中4个像素的颜色?

image - 读取图像的像素颜色

java - 确定特定像素是否在形状处理内

C++ 整数后跟 char 被接受为输入

c++ - 如何使用模板创建带有斐波那契数的编译时模板化集/数组/vector ?

c++ - OpenGL:未定义 VBO 函数

c++ - 3d 空间中两个 vector 之间的角度

opengl - 如何为每个垂直同步执行一次渲染(不重复,不跳过)?

c++ - 我如何使用 glCreateBuffers() 而不是 glGenBuffers()?

c++ - 在远程桌面中创建 DirectX 设备失败