[Release]Antialiasing

01/19/2012 20:53 Nubody#1
Hi,
I want to share this with the com.

Open the d3dapp.cpp and find
Code:
hr = m_pD3D->CreateDevice( m_d3dSettings.AdapterOrdinal(), pDeviceInfo->DevType,
It's placed below #else.

Change
Code:
	hr = m_pD3D->CreateDevice( m_d3dSettings.AdapterOrdinal(), pDeviceInfo->DevType,
								m_hWndFocus, behaviorFlags, &m_d3dpp,
								&m_pd3dDevice );
to
Code:
	m_d3dpp.SwapEffect      = D3DSWAPEFFECT_DISCARD;
	m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONMASKABLE;
	m_d3dpp.MultiSampleQuality = 6;
	m_d3dpp.BackBufferFormat = D3DFMT_R5G6B5;
	m_d3dpp.EnableAutoDepthStencil = TRUE;
	m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
	m_d3dpp.Flags = 0;


	hr = m_pD3D->CreateDevice( m_d3dSettings.AdapterOrdinal(), pDeviceInfo->DevType,
								m_hWndFocus, behaviorFlags, &m_d3dpp,
								&m_pd3dDevice );

	m_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

	m_pd3dDevice->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
Finish.

Now the edge render is more detailed.

Mfg. Nubody
01/19/2012 21:17 Lumi#2
Any Screen ? ;)
01/19/2012 22:49 Bimsala#3
Mit
[Only registered and activated users can see links. Click Here To Register...]
Ohne
[Only registered and activated users can see links. Click Here To Register...]

An der Laterne sollte man es eig. gut sehen.
01/20/2012 10:31 Yasunai#4
Für mich sehen die Laternen gleich aus.
01/20/2012 10:37 dennisdra#5
Es geht ja auch um die Kanten - bzw. in Flyff eher "Zacken" Glättung.
Man konnte das sehr gut an den alten Zäunen in Flaris erkennen.
01/20/2012 10:40 Yasunai#6
Stimmt danke, aber an den Laternen sieht man es echt nicht :/
01/20/2012 10:41 dennisdra#7
Doch, am Leuchtkegel der Laternen. Dort sind um den Leuchtkörper kleine zacken ^^
Vielleicht siehst du es nicht so extrem, da vllt. dein Bildschirm kleiner ist oder du weniger Kontrast am Bildschirm hast.
01/20/2012 10:58 Flash!#8
Man erkennt es auf Bildern weniger.
Auf Monster Flyff (die haben das schon länger) habe ich das eindeutig erkannt
und bekannte Flyff Models/Obj. sehen eindeutig besser aus.

__

Thanks for this release, very useful.
01/20/2012 13:58 guardianangel#9
MonsterFlyff hat nicht nur das die haben auch AlphaBlending & MSAA ...
Bei denen Ist der Hintergrund weicher und die Character sind viel detailierter ^^

Jedoch hier beim AntiAliasing sieht man auch einen Großen undterschied es is nicht mehr so eklig eckig ^^
01/20/2012 17:06 svedigekurt#10
My neuz is crashing when I put this in.
I did exactly what you said and copied the code.
What am I doing wrong? =3=
01/20/2012 17:32 nathan1912#11
i crash, please help
01/20/2012 18:13 Shuya83#12
Sollte man nicht einbauen, da sonst viele spieler die kein leistungsstarken PC oder Notebook haben ins game kommen.
01/20/2012 18:30 jcdace#13
The Problem with crashing is, your Graphics card isnt compatible with the multisampling rate you have set in the source.

This means ANY computer that cannot accept 6x MSAA on youre client WILL crash....making this code UTTERLY redundant.

(you can see what i mean if u set the multisamplequality to 0, you wont crash)


You need to have the source detect whether ur graphics card is compatible to MSAA, and if it is, what level it can go to.

To do this you have to add a CheckDeviceMultiSampleType Function.
01/20/2012 18:42 svedigekurt#14
Quote:
Originally Posted by jcdace View Post
The Problem with crashing is, your Graphics card isnt compatible with the multisampling rate you have set in the source.

This means ANY computer that cannot accept 6x MSAA on youre client WILL crash....making this code UTTERLY redundant.

(you can see what i mean if u set the multisamplequality to 0, you wont crash)


You need to have the source detect whether ur graphics card is compatible to MSAA, and if it is, what level it can go to.

To do this you have to add a CheckDeviceMultiSampleType Function.
Thanks.
The funny thing is that I have 2 ATI Radeon HD 5790 graphics cards, 2gb each.
So it's odd that they don't support a simple x6 antialiasing lol.
01/20/2012 19:17 jcdace#15
Yeah my computer is a good one, can run skyrim in ultra settings on 16x MSAA =\ but on flyff only x2 for me.... very strange...

But here is my code to determine the MSAA x

Code:
	DWORD MSQuality = 0;
	m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_NONMASKABLE, &MSQuality);
	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 Quality = x%d", MSQ );
	//	MessageBox( NULL, msaaText, "MSAA AMOUNT", MB_OK );
	// -------------------------------------------------------------------

	m_d3dpp.SwapEffect      = D3DSWAPEFFECT_DISCARD;
	m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONMASKABLE;
	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_CULLMODE, D3DCULL_NONE);

	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);