超级模糊的纹理 - XNA [英] Super blurry textures - XNA
问题描述
当我近距离观察我的纹理时,我的纹理似乎变得非常模糊.我正在创建一个类似我的世界的地形东西,我希望纹理被像素化 - 就像它是制作的而不是 XNA 尝试为我平滑它.
I seem to be getting really blurry textures when I look at my textures up close. I am creating a minecraft-like terrain thing and I would like the textures to be pixelated - like it is made rather than XNA try to smooth it out for me.
它的显示方式如下:http:///s1100.photobucket.com/albums/g420/darestium/?action=view¤t=bluryminecraftterrain.png
如有任何建议,我们将不胜感激.
Any suggestions would be much appeciated.
推荐答案
它与抗锯齿无关...它与硬件如何对纹理中的纹素进行采样有关.XNA 中的默认过滤器通常是线性的,但要获得那些看起来块状"的纹理,您必须使用 Point.
It's not related to anti-aliasing... it's related to how the hardware samples the texels in the texture. The default filter in XNA is usually Linear, but to get those "blocky" looking textures you must use Point.
在 C# 中,您可以将任何 SamplerStates 设置为使用 PointWrap.这是点过滤与 UV 环绕的组合.
In C# you can set any of your SamplerStates to use PointWrap. This is a combination of point filtering with UV wrapping.
// any state index from 0 to 15, textures usually take 0 first
GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
然而,它必须分配给与 SamplerState 相同的寄存器.例如.寄存器 s0 通常是 SamplerStates[0].或者,您可以在着色器上强制执行采样器状态,并在那里设置您的寄存器:
However it must the one assigned to the same register as the SamplerState. eg. register s0 will usually be SamplerStates[0]. Alternatively you can enforce sampler states on the shader, and set your registers there:
sampler2D textureSampler : register(s0) = sampler_state
{
Texture = <Texture>;
MipFilter = Point;
MagFilter = Point;
MinFilter = Point;
AddressU = Wrap;
AddressV = Wrap;
};
您也可以将 MipFilter 设置为 None 强制关闭 mipmapping.
You can also force mipmapping off with MipFilter set to None.
这篇关于超级模糊的纹理 - XNA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!