How do I enable bilinear filtering in DirectX?
How do I enable bilinear filtering in DirectX? Is it enabled by default?
What I'm trying to do is render a large scene to a small texture and then stretch it back over the entire scene again... (eg. a simple bloom effect)
The default filter mode is point filtering. Assuming you're using the fixed function pipeline:
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
If you're using shaders, I've no idea.
EDIT: This actually shows up if you type "bilinear" into the SDK docs "Search" tab...
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
If you're using shaders, I've no idea.
EDIT: This actually shows up if you type "bilinear" into the SDK docs "Search" tab...
Quote:Original post by Evil Steve
The default filter mode is point filtering.
Don’t trust the default. Many drivers use better filters when you don't set them at all.
Quote:Original post by Evil Steve
Assuming you're using the fixed function pipeline:
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
For bilinear you should add SetSamplerState (D3DSAMP_MIPFILTER, D3DTEXF_POINT).
SetSamplerState (D3DSAMP_MIPFILTER, D3DTEXF_LINEAR) will give you trilinear.
Quote:Original post by Evil Steve
If you're using shaders, I've no idea.
It is the same. Shaders respect the sampler states too.
When using shader in the FX system, you often set the sampler states in the FX file itself.
Omitting states will likely use whatever was set in code, which can be useful for setting the states globally.
texture diffuseTexture : DiffuseTexture;sampler DiffuseTextureSampler = sampler_state { texture = <diffuseTexture>; AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MIPFILTER = LINEAR; MINFILTER = LINEAR; MAGFILTER = LINEAR;};
Omitting states will likely use whatever was set in code, which can be useful for setting the states globally.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement