• Advertisement
Sign in to follow this  

Anti-Aliasing

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

When i create a mesh with textures in 3DS Max or blender, When using it in my game-application it looks like the pixel-game before Voodoo 2 3dfx came. i want to use Anti-aliasing to smooth out the textures. i am using Managed C# with a Geforce 8800GTX card. i think it would be a preset of the 3ddevice but i don´t have the syntax and i can´t find it on the internet. where do i start? tnx prehand.

Share this post


Link to post
Share on other sites
Advertisement
Hi, it may be multisample you are looking for


//here is some code to get the sample

//------------------------------------------------------------------------------------
//this will return the multisample that this device can support
//we will start at D3DMULTISAMPLE_6_SAMPLES and work back wards if the card canmt support it
//-------------------------------------------------------------------------------------
void GetMultiSampleSupported(DWORD *pQualityLevels, D3DMULTISAMPLE_TYPE *type)
{
HRESULT r1, r2;
DWORD QualityLevels = 0;

D3DMULTISAMPLE_TYPE types[6] = {D3DMULTISAMPLE_8_SAMPLES, D3DMULTISAMPLE_7_SAMPLES, D3DMULTISAMPLE_6_SAMPLES, D3DMULTISAMPLE_4_SAMPLES, D3DMULTISAMPLE_3_SAMPLES, D3DMULTISAMPLE_2_SAMPLES};

for(int ctr = 0; ctr < 6; ctr++)
{
QualityLevels = 0;
r1 = D3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8,
FALSE, types[ctr], &QualityLevels);
if(SUCCEEDED(r1))
{
//QualityLevels = 0;
r2 = D3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, D3DFMT_D24S8,
FALSE, types[ctr], &QualityLevels);
if(SUCCEEDED(r2))
{
//we can use this sample so lets set it
*pQualityLevels = 0;//QualityLevels;
*type = types[ctr];
//TCHAR buff[MAX_PATH];
//sprintf_s(buff, MAX_PATH, "QualityLevels = %d, Sample Level = %d", QualityLevels, types[ctr]);
//MessageBox(Hwnd, buff, "AppWin::GetMultiSampleSupported()", MB_OK);
return;//where done
}//end found back buffer and stencil buffers multi sample types

}//end found a match

}//end all sample types

//we neaver set a type so set one
*pQualityLevels = 0;
*type = D3DMULTISAMPLE_NONE;

}//end GetMultiSampleSupported
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////









//how to use it

D3DPRESENT_PARAMETERS D3DPresentPrams;//fill in other members as well you will
DWORD QualityLevels = 0;
D3DMULTISAMPLE_TYPE multisampletype = D3DMULTISAMPLE_NONE;

GetMultiSampleSupported(&QualityLevels, &multisampletype);

D3DPresentPrams.MultiSampleType = multisampletype;//D3DMULTISAMPLE_6_SAMPLES;//D3DMULTISAMPLE_4_SAMPLES ;//D3DMULTISAMPLE_NONE;
D3DPresentPrams.MultiSampleQuality = QualityLevels;


Share this post


Link to post
Share on other sites
I'm not sure about MDX, but in un-managed you want to turn on texture filtering (It defaults to nearest neighbour). The following will enable trilinear filtering for instance:

pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement