Texture Blending Problem (with screenshots)

Started by
2 comments, last by Kibble 19 years, 8 months ago
I am experimenting with how to blend textures together. Using the DirectX MFCTex tool I get this result: When I copy the source they generate and try it out myself the resulting image appears "blocky" and not smooth: Any ideas why my blending does not come out smooth like it does in the MFCTex tool? My vertices are defined as and the block I texture is a simple quad:

public struct MyVertex
{
	public float    X,Y,Z;
	public Int32	dwDiffuse;
	public float    Tu1,Tv1;
	public float    Tu2,Tv2;
}

Thanks in advanced.
Advertisement
You need to enable bilienear filtering for that stage:
pDevice->SetTextureStageState(stage with that texture, D3DTSS_MINFILTER, D3DTEXF_LINEAR);pDevice->SetTextureStageState(stage with that texture, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);

You probably don't need it for minification, but magnification definitely.

edit: Oops, I didn't notice you were using C#. I don't know C#, but search for the filtering properties in the managed documentation.
Ah, great!!

I found in C# you have to call SetSamplerState() instead of SetTextureStateStage():

_DXDevice.SetSamplerState(0, SamplerStageStates.MinFilter, (int)TextureFilter.Linear);
_DXDevice.SetSamplerState(1, SamplerStageStates.MagFilter, (int)TextureFilter.Linear);
Actually that is a Direct3D 9 thing, not just managed, but yes, that is stuff you need :)

This topic is closed to new replies.

Advertisement