yeah /facepalm. ^^
Ive removed it from all my posts anyway, I shoulda noticed it sooner tho xD
Printable View
What is most annoying is how it seemingly uses only a single mesh group within an o3d as the culling mesh, so if u had a giant castle and it selected the door as the culling mesh then whenever the door is off camera the whole castle vanishes -.-
idk if there is a way around this, i havent really looked to try.
But yeah its like Hitler...somehow xD.
Some people in forums i researched about that part, were saying it was adding +1 to the MSAA so that was added to counteract it, you could probably add additional code to the thing.
like
if( MSQ == 7 )
MSQ == 8;
or something like that if it isnt adding +1,
but for me, mine can handle x16 aswell, but for some reason on flyff it only does x2 =\.... but it comes up as x2...which means it was originally x3 for me before doing the -1.
Maybe its certain graphics cards or something, did it cause any problems ingame when it said x7???
Wrong kinda culling homezki.~
All the vertices in the mesh are transformed into screenspace, then the cross product of each triangle is found, and if the Z coordinate is - [I think it's negative, I'm sleepy shut up] then it doesn't keep going through the pipeline.
What you're talking about is frustum culling, which is handled by the program, flyff in our case. Sadly, FlyFF's frustum culling is retarded.
See here, it gives a comparison of the two.
weeeeeee
Occlusion culling I believe is testing whether large objects such as buildings would obscure other objects in the scene in camera space. Like for example, that would check if a player was on the other side of Saint Morning's cathedral thing. No way in hell you'll be able to see them so why render em? The math's basically the same as finding a shadow volume, then just do the same thing as frustum culling but you're checking if it's in the occlusion volume. Yeah. Dig it.
Pff. You make some sick-ass maps bro, we all got our strengths. :3
The MSDN page below describes why you have to take one from the CheckDeviceMultiSampleType function.
IDirect3D9::CheckDeviceMultiSampleType method
Also from my understanding the value that is returned by that isn't your MSAA multiplier. It is the number of quality levels the card supports for the sample type (low, medium and high in this case), which is why most of you are getting 2(High). To set it use a specific MSAA multiplier you need to use one of the mask enumerators for the MultiSampleType property. ie:
I've done very little with DirectX but that's my understanding after reading about it, so if someone more knowledge wants to correct me feel free.Code:m_d3dpp.MultiSampleType = D3DMULTISAMPLE_4_SAMPLES;
I looked into nabby59's information, and he is correct.
You should change it to:This starts by testing MSAAx8 and uses that if you can. If not, it tries MSAAx4. As a last resort, it does MSAAx2. If none are supported, it leaves the default of none.Code:DWORD MSQuality = 0;
int 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);
Shadow u forgot in your code after every if/else one ")" at the end of line.
Also it says:
Code:J:\@Source\Official Source\_DirectX\d3dapp.cpp(924): error C2440: '=' : cannot convert from 'int' to 'D3DMULTISAMPLE_TYPE'
Just change this:
To this:Code:int MSType = D3DMULTISAMPLE_NONE;
It works fine for me :>Code:D3DMULTISAMPLE_TYPE MSType = D3DMULTISAMPLE_NONE;
Ok, so I'm not perfect lol but you got the idea =P I didn't actually test that coding, just wrote it up real quick.
Thank you for working on this code like a REAL community xD, i'll try out Shadow's code and edit the first post to the same thing.
:)
corrected shadow's code:
Compiled w/o errors, so should work.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);
Uh, good job Jomex, but Jcdacez already corrected it and put that on the first post lol
If I may make a suggestion, I would just force Quality to always be 0. Check this out:
Basically, count's the only thing that matters, as it's sampling 2, 4, 8, 16 places in the same pixel and combining em, but quality tells it where to sample from. Problem is, it's hardware dependent. Setting it to a higher value won't necessarily improve results, and can even give poorer results at times. When you specify 0, it will give consistent results across all cards generally, so you know what it'll look like in the end.Quote:
The meanings of these quality levels are defined by the device manufacturer and cannot be queried through D3D. For example, for a particular device different quality levels at a fixed sample count might refer to different spatial layouts of the sample locations or different methods of resolving.
Unless, of course, you have a db of cards and manufacturers and pick settings from that. I think one of the DX samples uses that, but not quite sure there.
Currently though, there's NO cards that support 16x MSAA.
It's capped at 8x and querying d3d for all supported AA types give 0 - 8 depending on your graphics card.
You can cast an integer to the D3D type.