Public Group

# How do you dissable anti-aliasing when using ID3DXSprite?

This topic is 4972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I dont want my sprites blurred like this, how do I turn this off? Also, the bitmap gets stretched, how do i turn this stretching off? I would be very thankfull for an answer to this, 'cause I cant figure it out. Mikael Sweden

##### Share on other sites
When you load the texture with D3DXCreateTextureFromFileEx(), you can specify the filtering to be used. If you specify D3DX_FILTER_NONE, then no dithering/stretching will occur.

Also, you should ensure that your texture files have dimensions that are powers of 2. If you don't, then DirectX will stretch them to the next power of 2 upon loading.

##### Share on other sites
I am assuming that you are using DirectX9.
Ok to fix the Antialias problem with DirectX9 one of the first thing you
must do is when you Load you Bitmaps or any other format for that matter using
the D3DXCreateTextureFromFileEx make sure that the parameters that determined the image filter be set to D3DX_FILTER_NONE or D3DTEXF_POINT, then after you call the begin state of the sprite make sure you change the Sampler State of the Texture Index to D3DTEXF_POINT as well. Because after you call the Begin Method of the Sprite D3D does some Internal Changes to the renderstates and Sampler States so that is why you must change the state after you call the Begin Method. i hope that helps you.

By the way D3DX_FILTER_NONE will make sure that if the Image you specify is not power of two it will make it power of it without streching the image. What it does is make it power of two and add black to the part that is not part of the texture.

##### Share on other sites
In addition to what Drexl said, make sure you also set the sampler state as BornToCode said. If I remember correctly, the code would look like this:

m_d3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER,D3DTEXF_POINT); m_d3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER,D3DTEXF_POINT);m_d3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER,D3DTEXF_POINT);

EDIT: As the others said, if your bitmap isn't a power of 2 then it'll get stretched, blurred, and distorted. Thus if you make your bitmap dimensions a power of 2, then it should look fine, and you don't have to disable the AA. If you're planning to rotate your sprites then I highly recommend leaving AA on, without it the sprites look really bad.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634092
• Total Posts
3015445
×
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.26430368423461914, "perplexity": 1872.5445798216017}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-04/segments/1547583662863.53/warc/CC-MAIN-20190119074836-20190119100836-00419.warc.gz"}