Sign in to follow this  

Texture Blending Problem (with screenshots)

Recommended Posts

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.

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
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);

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this