[DX9, C++] Smooth scaling 2D sprites

Started by
3 comments, last by blairhartley 14 years, 1 month ago
I'm in the process of reducing my engine's reliance on ID3DXSprite by implementing my own 2D-quad-based class. At each stage I'm comparing the equivalent result I get using the ID3DXSprite method with the new one, and it's here I'm seeing a reduced quality scaling compared to ID3DXSprite. The scaled ID3DXSprite sprites appear smoothed. My equivalent scaled quads don't. I appreciate there are 1001 render settings, but for this simple thing - to match the basic quality ID3DXSprite gives you when scaling a texture - is there an obvious setting for rendering my quads? Many thanks in advance, Tim
Advertisement
You could use PIX to see what your code and ID3DXSprite are doing differently by running both methods through PIX and comparing the D3D call logs (PIX is a utility that comes with the DX SDK).
Good thought... and very useful. Looks like it's down to differences in calls to SetSamplerState.

Many thanks,
Tim
If you look here it shows you all of the render, texture, and sampler states set when you call ID3DXSprite::Begin. What you're interested are the MINFILTER, MAGFILTER, and MIPFILTER sampler states.
Quote:Original post by MJP
If you look here it shows you all of the render, texture, and sampler states set when you call ID3DXSprite::Begin. What you're interested are the MINFILTER, MAGFILTER, and MIPFILTER sampler states.


Thankyou - that's also useful... I am now setting those filter values and the scaling blending is now identical.

I'm now struggling trying to match the texture and display coordinates so they are exactly the same regardless of scale or rotation... seems I'm doing something slightly different to ID3DXSprite as I can match everything pixel for pixel in one orientation, but not in another.

This topic is closed to new replies.

Advertisement