Kurask

Members
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

154 Neutral

About Kurask

  • Rank
    Newbie
  1. In-Game Console

    Thanks for the suggestions; I ended up getting everything working. I was looking for functions that handled it altogether in case one existed. As stated earlier, the code to make one was pretty simple (I imagined it being a little more difficult than it turned out to be).
  2. In-Game Console

        Using CreateWindowEx isn't going to make a console that's really usable in-game, unless you are running windowed mode. IIRC DirectX has some font rendering classes if you are using earlier versions. Check the SDK samples.   As for logging: echoing from a file is not the greatest idea. Buffers can take time to flush. You may not want to lock a file constantly while a program is running (and conversely lock it while reading).   There are a bunch of good logging frameworks out there (check this thread on stackoverflow) that let you have multiple backend emitters. I use Boost.Log (not officially part of boost) in my projects and it works great for that sort of thing. Yeah, I can render text to the screen, I just wasn't sure if it was efficient to do so.   I don't know how I'd get started on binding input to the source, or even getting input to appear on the screen instead of using it to control the camera, as nife87 said above. 
  3. In-Game Console

    That's what I was thinking. I'd have my output go to some text file and have something constantly echo whatever is in that file onto the screen. I don't know the best way to do that though. My project is in C++ using DirectX for the  graphics. I was thinking I'd just make a textbox using CreateWindowEx that displayed all the output and I'd have another textbox slightly below that to handle the input. I'd have to figure out how to do that, but it sounds reasonable.
  4. In-Game Console

    Well, that word helped loads. Searching "console" was not helpful at all with Google, but there are many more results for that. Thanks!   I think the way to do it would be to have 2 text boxes (CreateWindow), one read-only and one to type in. The read only would echo whatever goes into a log file and the write one would handle the commands.
  5. 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.
  6. Using D3D11_QUERY_OCCLUSION

    Fair enough, I figured it wasn't that great of a way. I'll look for another method then. In the end, I only plan on having maybe 5 different models and have them rendered thousands of times each.
  7. Using D3D11_QUERY_OCCLUSION

    Hey there, I've been working on it here still. I see what you mean about fetching results immediately, and I fixed that. I also now create the array of query objects prior to runtime. Both improved the performance, however, I'm still doing something wrong as it does not actually do any culling. Here's my new code. The render count always shows up as 0, therefore nothing is being set as OK to render with the correct texture. However, all of the object are rendered with the 20x20 texture, so the first loop is working. [source lang="cpp"] // Go through all the models for(int index = 0; index < modelCount; index++) { // Get the position of the model m_ModelList->GetData(index, positionX, positionY, positionZ, color); // Leftovers radius = 1.0f; // Check if the model is in the frustum renderModel = m_Frustum->CheckCube(positionX, positionY, positionZ, radius); // If it can be seen... if(renderModel) { // Move the model to the location it should be rendered at. D3DXMatrixTranslation(&worldMatrix, positionX, positionY, positionZ); // Prime the buffers m_Model->Render(m_D3D->GetDeviceContext()); // Start the query m_D3D->GetDeviceContext()->Begin(m_pPredicate[index]); // Render the model to the world using the 20x20 texture result = m_LightShader->Render(m_D3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(2), m_Light->GetDirection(), m_Light->GetAmbientColor(), m_Light->GetDiffuseColor()); // End the query m_D3D->GetDeviceContext()->End(m_pPredicate[index]); // Reset the world matrix m_D3D->GetWorldMatrix(worldMatrix); } } // Go through all the models for (int index = 0; index < modelCount; index++) { // Stores the result of the query bool renderM = 0; // Get the result of the query and store it to renderM m_D3D->GetDeviceContext()->GetData(m_pPredicate[index], &renderM, sizeof(BOOL), 0); // If the query said the object was OK to render... (IS NOT WORKING AT ALL) if (renderM == true) { // Reset the status to false m_D3D->GetDeviceContext()->SetPredication(m_pPredicate[index], FALSE); // Get the model information m_ModelList->GetData(index, positionX, positionY, positionZ, color); // Move the model to the right location D3DXMatrixTranslation(&worldMatrix, positionX, positionY, positionZ); // Prime the buffers m_Model->Render(m_D3D->GetDeviceContext()); int texture; if (positionY == 0) texture = 3; else if (positionY >= -16) texture = 2; else texture = 1; // Render the model to the screen with the right 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()); // Reset to the original world matrix. m_D3D->GetWorldMatrix(worldMatrix); // Since this model was rendered then increase the count for this frame. renderCount++; } }[/source] And now I have to ask, how is everyone else handling this? It doesn't appear to be a common question on the internet at all! Right now my testing is done with 1 model rendered in 10,000 different locations, but that will increase massively once I find a good method for occlusion. The FPS performance is already far less than I want for what I currently have.
  8. 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]