alabdaly891
alabdaly891

Reputation: 159

direct3d9 how to filter texture for pixel art

hello i want to make pixel art image looks less blurry i tried set sampler state but i see no difference

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

enter image description here

i tried almost everything in setsamplerstate but i see no difference at all

i know i can make the photo bigger using photoshop but can i just make it looks hard edge with direct3d9

Upvotes: 0

Views: 683

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41117

"Pixel art" is typically drawn without any blending or bi-linear filtering. For legacy Direct3D 9, you'd use (assuming your textures are bound to slot 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.

Upvotes: 1

Related Questions