Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Kurask

Member Since 11 Oct 2012
Offline Last Active Aug 29 2013 05:13 PM

Topics I've Started

In-Game Console

12 January 2013 - 11:41 AM

What are the consoles that we see in games made of? For example, Quake's console http://gregdolleysblog.files.wordpress.com/2008/01/image.png . 

 

I've made one with AllocConsole, but that opens in a seperate window. I'm looking to make one that just takes up a portion of the screen when toggled on like we see in most games.


Using D3D11_QUERY_OCCLUSION

11 October 2012 - 02:09 PM

Has anyone used this for the purpose of occlusion culling and had it work for them?

I must be doing something wrong because it drops me from 70FPS (Frustum Culling only, 10,000 objects) to 1FPS and only half works (only one block works as an occlusion culler). If there is a better method for occlusion culling, please let me know. This appears to work well when used correctly, but I'm not sure how to correctly use it.... and I find Microsoft's reference guide to be useless for learning.


[source lang="cpp"] // Setup how the query functions queryDesc.Query = D3D11_QUERY_OCCLUSION; queryDesc.MiscFlags = 0; // Create the query m_D3D->GetDevice()->CreateQuery(&queryDesc, &pQuery); // Go through all the models and render them only if they can be seen by the camera view. for(index=0; index<modelCount; index++) { // Get the position and color of the object model at this index. m_ModelList->GetData(index, positionX, positionY, positionZ, color); // Texture number that holds the low resolution occlusion texture texture = 4; // Start the query m_D3D->GetDeviceContext()->Begin(pQuery); // Matrix translation D3DXMatrixTranslation(&worldMatrix, positionX, positionY, positionZ); // Render the object's occlusion texture result = m_LightShader->Render(m_D3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(texture), m_Light->GetDirection(), m_Light->GetAmbientColor(), m_Light->GetDiffuseColor()); // End the query m_D3D->GetDeviceContext()->End(pQuery); // Get the data from the query and determine if object should be rendered // Returns whether or not a object is in view. If 0, then the object is not in view. while ( S_OK != m_D3D->GetDeviceContext()->GetData(pQuery, &queryData, sizeof(UINT64), 0 ) ) { // If object is not in view if (queryData == 0) // Should not be rendered renderModel = false; // If object is in view else // Should be rendered renderModel = true; } // Render the model if it was in view if(renderModel) { // Move the model to the location it should be rendered at. D3DXMatrixTranslation(&worldMatrix, positionX, positionY, positionZ); // Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing. m_Model->Render(m_D3D->GetDeviceContext()); // Random texture thing (worked before this occlusion culling. now the culling texture takes over) if (positionY == 0) texture = 3; else if (positionY >= -16) texture = 2; else texture = 1; // Render the model using the light shader. result = m_LightShader->Render(m_D3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(texture), m_Light->GetDirection(), m_Light->GetAmbientColor(), m_Light->GetDiffuseColor()); // Reset to the original world matrix. m_D3D->GetWorldMatrix(worldMatrix); // Since this model was rendered then increase the count for this frame. renderCount++; } }[/source]

PARTNERS