[Source] Multi-Sample Anti-Aliasing in Flyff
Well i got shown this on another site but it wasnt working correctly
(if your card couldnt support AA the client would jus crash)
UPDATE (01/02/2012) : The Code Below has been Improved, Thanks to nabby59 and ShadowDragon42 for the research/coding help with this!
SO i decided to release a code i did which so far, seems to be working fine.
For those who dont know, Anti-aliasing, in a nutshell takes all those "Jagged" looking edges on models, and smooths them out some, giving a cleaner look ingame, obviously the higher the multiplied sampler, the better the quality.
What the code itself does, is checks to see if your graphics card is compatible with the anti aliasing and checks what multisample level you can use on your graphics hardware for Flyff, and sets it to that.
To add this....
in d3dapp.cpp find:
Code:
#ifdef __XUZHU
#if 0
// Create the device
hr = m_pD3D->CreateDevice( m_pD3D->GetAdapterCount()-1, D3DDEVTYPE_REF,
m_hWndFocus, behaviorFlags, &m_d3dpp,
&m_pd3dDevice );
under the SECOND #else after this replace:
Code:
hr = m_pD3D->CreateDevice( m_d3dSettings.AdapterOrdinal(), pDeviceInfo->DevType,
m_hWndFocus, behaviorFlags, &m_d3dpp,
&m_pd3dDevice );
with this:
Code:
DWORD MSQuality = 0;
D3DMULTISAMPLE_TYPE MSType = D3DMULTISAMPLE_NONE;
if( SUCCEEDED( m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_8_SAMPLES, &MSQuality) ))
MSType = D3DMULTISAMPLE_8_SAMPLES;
else if( SUCCEEDED( m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_4_SAMPLES, &MSQuality) ))
MSType = D3DMULTISAMPLE_4_SAMPLES;
else if( SUCCEEDED( m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, &MSQuality) ))
MSType = D3DMULTISAMPLE_2_SAMPLES;
int MSQ = MSQuality - 1;
// --------------------------------------------------------------
// ... Below Will Display a message box on Start-Up with the AntiAliasing
// ... Multisample level Your Graphics card can handle .
// ---------------------------------------------------------------
// char msaaText[128];
// sprintf( msaaText, "Multi Sample Type = x%d", MSType );
// MessageBox( NULL, msaaText, "MSAA AMOUNT", MB_OK );
// -------------------------------------------------------------------
m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_d3dpp.MultiSampleType = MSType;
m_d3dpp.MultiSampleQuality = MSQ;
m_d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
m_d3dpp.EnableAutoDepthStencil = TRUE;
m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
m_d3dpp.Flags = 0;
m_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
hr = m_pD3D->CreateDevice( m_d3dSettings.AdapterOrdinal(), pDeviceInfo->DevType,
m_hWndFocus, behaviorFlags, &m_d3dpp,
&m_pd3dDevice );
m_pd3dDevice->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
m_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
m_pd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
m_pd3dDevice->SetRenderState(D3DRS_ALPHAREF, (DWORD)8);
m_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
I hope this helps.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Wow, Amazing that this tiny codes can create anti aliasing.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
This is probably the most hacky and stupid implementation ever.
Just implement it natively where it loads the settings instead of blindly overwriting all determined settings.
This could have been accomplished with 1 changed line and 1 added line.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Quote:
Originally Posted by
spikensbror
This is probably the most hacky and stupid implementation ever.
Just implement it natively where it loads the settings instead of blindly overwriting all determined settings.
This could have been accomplished with 1 changed line and 1 added line.
I didn't make the code on the anti-alias itself so I'm not even going to regard your comment on the implementation strategy on a personal level :laugh:
Fact of the matter is, as far as i can see, what others can see, it works, it adds multiple sampling levels, it detects if u can handle such a level of multisampling or not.
Yeah its not the BEST method, but do u see another method on this page, better yet, if you have a 1 line change, where is the link to the release?....
Exactly...There wasn't an MSAA code on this site, this one does the job, so i posted it...
I'm not swinging my E-Dick to the public im jus posting something people want on their server, I'm NOT a fantastic coder myself, I'm a learner like most, i can do Basics and i DIDN'T know this and MAYBE this will branch an understanding in this level of code to SOME extent that more advanced things in terms of Anti-aliasing, HDR, or anything of that nature, processing/post-processing to others too.
Complain that the community sucks cos no one releases, yet be over critical of a basic release that helps =\...Logic much.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
I know who made it, The most epic flyff developer in history! Not gonna name him XD
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Quote:
Originally Posted by
driftcity
I know who made it, The most epic flyff developer in history! Not gonna name him XD
yeah but saying the most epic flyff developer is like saying The Worlds Fastest Slug :P i jk
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Quote:
Originally Posted by
Jcdacez
Complain that the community sucks cos no one releases, yet be over critical of a basic release that helps =\...Logic much.
I gave up on the community a long time ago bro.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
what's the point of bullying here then?
This guys released something that can find its use.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Giving input on the release.
As I said, this overwrites a ton of settings which is predetermined by the d3dApp.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
True, no matter how simple or whatever you want to say, it makes the game look a lot nicer and I haven't seen you make anything better.
Haters gonna hate, Josh.
Posted via Mobile Device
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
don't you think it make the game more lagy?
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Quote:
Originally Posted by
kolelolx
True, no matter how simple or whatever you want to say, it makes the game look a lot nicer and I haven't seen you make anything better.
Haters gonna hate, Josh.
Posted via Mobile Device
His merely remarking that there are better ways to do this and this is not the most efficient way, retard.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Quote:
Originally Posted by
Max98
don't you think it make the game more lagy?
it's only more laggy if you're computer isn't good enough to handle it
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Well in that case I do not think that this is a good implementation. There should be an option to enable or disable AA. Even though most computers nowadays should be able to handle it a lot of players run other things next to flyff and rather have settings a little it lower so it runs more smooth.
I am not implying that there should be a spoon fed tutorial on how to do this, just merely saying that this is not the best implementation and how I think it should be done.
Re: [Source] Multi-Sample Anti-Aliasing in Flyff
Quote:
Originally Posted by
Langstra
Well in that case I do not think that this is a good implementation. There should be an option to enable or disable AA. Even though most computers nowadays should be able to handle it a lot of players run other things next to flyff and rather have settings a little it lower so it runs more smooth.
I am not implying that there should be a spoon fed tutorial on how to do this, just merely saying that this is not the best implementation and how I think it should be done.
When I learned enough about DirectX, I was planning to do exactly that, adding the new options into the patcher. I just sorta got bored of reading DirectX books lol so I haven't gotten around to finishing that.
To do it correctly, you should check if their device is capable of the setting (antialiasing, anisotropic filtering, etc.), then either enable or disable the option for it. If they select it, it's just as simple as spiken said to implement: 1 changed line and 1 added line. (I already know about the functions, I just never got through the first part I said xD)