Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

282 Neutral

About Mumsfilibaba

  • Rank

Personal Information

  • Interests
  1. So I've got a quite interesting problem that only happens on my laptop. I have a window with the following WNDCLASSEX struct specifed: m_Desc.hInstance = (HINSTANCE)GetModuleHandle(0); m_Desc.lpfnWndProc = stdWinProc; m_Desc.cbClsExtra = 0; m_Desc.cbWndExtra = 0; m_Desc.hbrBackground = RE_WINDOW_BACKGROUND_COLOR_DARKGRAY; m_Desc.hCursor = RE_CURSOR_STANDARD; m_Desc.hIcon = RE_ICON_STANDARD; m_Desc.hIconSm = 0; m_Desc.cbSize = sizeof(WNDCLASSEX); m_Desc.style = CS_HREDRAW | CS_VREDRAW; m_Desc.lpszClassName = L"DefWndClass"; m_Desc.lpszMenuName = 0; And I have a swapchain that have the following struct: DXGI_SWAP_CHAIN_DESC swapChainDesc; swapChainDesc.BufferCount = 1; swapChainDesc.BufferDesc.Format = format; swapChainDesc.BufferDesc.Height = height; swapChainDesc.BufferDesc.Width = width; swapChainDesc.BufferDesc.RefreshRate = mode.RefreshRate; swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; swapChainDesc.OutputWindow = (HWND)windowHandle; swapChainDesc.SampleDesc.Count = 1; swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapChainDesc.Windowed = true; I then bind and clear the rendertarget- and depthstencilview that is created for swapchain. And I do get the expected result as long as I don't resize my window. If I do the only thing that is displayed is the background that is specified in the WNDCLASSEX struct. I have had this problem before but haven't been able to really solve it. If I resize the buffers when I repond to the WM_SIZE message it works, but I want the buffers that are getting rendered to depend on the application's settings, like when you set the settings within the game for example. Or is the best practise to always resize the swapchain's buffers when the window gets resized and have I seperate rendertarget that I render my scene to, and then render that onto a quad to the buffers in the swapchain? And why do I not get the same results on my laptop and stationary computer? They are both nvidia and intelbased with the latest drivers so it should result in the same result right? Would be nice if someone could shed some light on this, because I haven't been able to find any relevant information about this. 
  2. Mumsfilibaba

    Implement baked AO-maps

    As I wrote I just multiplied the AO with the diffuse color. It was the first thing that came to mind.    EDIT: I now take the sampled color from the ao-map multiplied by the ambient light, then ambient result + diffuse color (the resulting color after normal calcuation etc)   "saturate((ambientCol * ao) + diffuse)"   Personally I think it looks alot better: [attachment=32544:No-AO_AO.png]
  3. Just a quick question, What is the standard equation for implementing baked AO-maps (from maya, 3DS max etc.)? Becuase of the fact that it is how much light a specific point is exposed to, would it not just be diffuse * ao?   Here is the result after I tested that: [attachment=32543:ao_no-ao.png]
  4. Mumsfilibaba

    Black screen after creating msaa Rendertarget

    The debuglayer is on, so I'm pretty sure it would have warned me if I tried to use a depthstencil that weren't multisampled. I'm not resolving the rendertarget. Is that really necessary when I create the rendertargetview with the multisampled texture? And in that case, why is that needed? Could it be that I only create one texture? I mean aren't there two, one front and back?
  5. Hi, I get only a black screen after trying to create a rendertarget with msaa. It worked perfectly before creating it. Here is the code:   bool D3DHandle::CreateRenderTarget() { //retrive BackBuffer ID3D11Texture2D* backBuffer = nullptr; HRESULT result = this->swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer); if (FAILED(result)) { MessageBoxW(this->outputWindow->GetWindowHandle(), L"Could not retrive BackBuffer from SwapChain", L"ERROR", MB_OK | MB_ICONERROR); return false; } //get backbuffer description and set multisampling D3D11_TEXTURE2D_DESC backBufferDesc; RtlSecureZeroMemory(&backBufferDesc, sizeof(D3D11_TEXTURE2D_DESC)); backBuffer->GetDesc(&backBufferDesc); this->sampleCount = backBufferDesc.SampleDesc.Count = 8; this->sampleQuality = backBufferDesc.SampleDesc.Quality = 32; this->renderHeight = backBufferDesc.Height; this->renderWidth = backBufferDesc.Width; backBuffer->Release(); backBuffer = nullptr; //create the backbuffer with multisampling result = this->device->CreateTexture2D(&backBufferDesc, nullptr, &backBuffer); if (FAILED(result)) { MessageBoxW(this->outputWindow->GetWindowHandle(), L"Could not create Backbuffer", L"ERROR", MB_OK | MB_ICONERROR); return false; } //create RenderTarget result = this->device->CreateRenderTargetView(backBuffer, nullptr, &renderTarget); if (FAILED(result)) { MessageBoxW(this->outputWindow->GetWindowHandle(), L"Could not create RenderTarget", L"ERROR", MB_OK | MB_ICONERROR); return false; } //release backbuffer backBuffer->Release(); backBuffer = nullptr; return true; }   I'm I not setting it correctly after creation?   Im calling this function after I created the depthbuffer: void D3DHandle::SetBuffers() { //set RenderTarget and DepthStencil this->immediateContext->OMSetRenderTargets(1, &this->renderTarget, this->depthStencil); }
  6. Mumsfilibaba

    Keyboard input Windows

    Solved it by not clearing the list every frame! Thanks!
  7. Mumsfilibaba

    Keyboard input Windows

    Here is my loop.   //messageloop while (msg.message != WM_QUIT) { //send message to windowproc-function while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessageW(&msg); } //update if (!System::Update(Update)) { //Exit the application on fail System::Exit(-1); } //render if (!System::Render(Render)) { //Exit the application on fail System::Exit(-2); } //clear this frames key actions so next one's empty Input::keysDown.Clear(); Input::keysUp.Clear(); }   Here is the messagehandling: case WM_KEYDOWN: Input::keysDown.Add(System::CheckKey(wParam)); return 0; case WM_KEYUP: Input::keysUp.Add(System::CheckKey(wParam)); return 0;
  8. Hi, quick question. How do I handle multiple keystrokes in Windows? At the moment I use the messageloop, and for every WM_KEYDOWN I check which key got pressed (translate it into an enum) and add it to a list with pressed keys. Then in my GetKeyDown method I loop through the list of pressed keys and return true if the key are in the list. But it seems like only one key gets registered every frame. If I hold down a key it gets registered, but if I hold down one other key at the same time, only the new one gets added. So is this a Windows thing? Should I do it in another way?
  9. Mumsfilibaba

    School project survey

    Thank you everyone for your feedback and a special thank you to all of you who answered. Since the question regarding the concept art of our game was the most criticized, we have remade that question so that you now kan write what you think, not only specific answeres. So if anyone feels that they couldn't finish the survey before, maybe can have another look at it.
  10. Mumsfilibaba

    School project survey

    Hello, as a final project in school, me and a couple of firends are developing a 2D game. Along with this we are going to write an essay. We need something to base this essay on. So we decided to make a survey with a couple of questions. It's mainly about mixing genres in games. I would appreciate if you could answer our survey.   http://goo.gl/forms/8ORMVKC6dz   Thanks!
  11. So I solved it. The problem were in the Vector2-class that is parent to the Vector3-class. The y value was set to the x value in the constructor. Vector2::Vector2(float x, float y) { this->x = x; this->y = y; } Vector3::Vector3(float x, float y, float z) : Vector2(x, y) { this->z = z; }
  12. Hello,   So I have run into an error that makes my program crash and I get the following error message:    Assertion failed!   Program: ...min\Source\Workspaces\Engine\Debug\Application.exe File: c:\program files (x86)\windows kits...\directx...rix.inl Line: 1912   Expression: !XMVector3Equal(UpDirection, XMVectorZero())   For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts   (Press Retry to debug the application - JIT must be enabled)   And I have no clue why. I did some chenges to the program: -Changed my naming-style of functions in every class -Enabled a debugging device   I have located the chrash to the following piece of code: DirectX::XMStoreFloat4x4(&this->viewMatrix, DirectX::XMMatrixLookToRH(this->position, this->lookAt, this->up)); The whole piece looks like this: Camera::Camera(Vector3 position, Vector3 rotation, Vector3 up, float fieldOfViewAngle, int renderWidth, int renderHeight, float nearPlane, float farPlane) { //initialize camera this->position = position; this->lookAt = Vector3(0.0f, 0.0f, 1.0f); this->up = up; this->rotation = rotation; this->viewMatrix = DirectX::XMFLOAT4X4(); DirectX::XMStoreFloat4x4(&this->cameraRotationMatrix, DirectX::XMMatrixRotationRollPitchYawFromVector(this->rotation)); //calculate new lookAt an up- vectors with camera rotation this->lookAt = DirectX::XMVector3TransformCoord(this->lookAt, DirectX::XMLoadFloat4x4(&cameraRotationMatrix)); this->up = DirectX::XMVector3TransformCoord(this->up, DirectX::XMLoadFloat4x4(&cameraRotationMatrix)); this->lookAt = DirectX::XMVectorAdd(this->position, this->lookAt); //create matrices DirectX::XMStoreFloat4x4(&this->viewMatrix, DirectX::XMMatrixLookToRH(this->position, this->lookAt, this->up)); DirectX::XMStoreFloat4x4(&this->projectionMatrix, DirectX::XMMatrixPerspectiveFovLH(fieldOfViewAngle, (float)renderWidth / (float)renderHeight, nearPlane, farPlane)); DirectX::XMStoreFloat4x4(&this->orthographicMatrix, DirectX::XMMatrixOrthographicLH((float)renderWidth, (float)renderHeight, nearPlane, farPlane)); DirectX::XMStoreFloat4x4(&this->cameraMatrix, DirectX::XMMatrixMultiply(DirectX::XMLoadFloat4x4(&this->viewMatrix), DirectX::XMLoadFloat4x4(&this->projectionMatrix))); DirectX::XMStoreFloat4x4(&this->cameraMatrix2D, DirectX::XMMatrixMultiply(DirectX::XMLoadFloat4x4(&this->viewMatrix), DirectX::XMLoadFloat4x4(&this->orthographicMatrix))); //transpose the matricies DirectX::XMStoreFloat4x4(&this->viewMatrix, DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&this->viewMatrix))); DirectX::XMStoreFloat4x4(&this->projectionMatrix, DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&this->projectionMatrix))); DirectX::XMStoreFloat4x4(&this->orthographicMatrix, DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&this->orthographicMatrix))); DirectX::XMStoreFloat4x4(&this->cameraMatrix, DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&this->cameraMatrix))); DirectX::XMStoreFloat4x4(&this->cameraMatrix2D, DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&this->cameraMatrix2D))); } The vector3s are my own vector class and a cast them to a XMVECTOR like this: Vector3::operator DirectX::XMVECTOR() const { return DirectX::XMVectorSet(this->x, this->y, this->z, 1.0f); } Does anyone have any idea what I could have done wrong?
  13. Thank you for noticing. That must be the problem, gonna test and report back
  14. I have checked it gets called. The differentierad functions are different versions of the same function. Different versions to see what the outcome were. I'm gonna look into it abit more
  15. Hehe.. oops, lookUp should be lookAt, and yes this->lookAt is my own Vector3. I haven't made an copy constructor so it's the default one. Yeah, I suspected that this function didn't do anything with the vector: Vector3 Vector3::operator=(const DirectX::XMVECTOR& vector) { return Vector3(DirectX::XMVectorGetX(vector), DirectX::XMVectorGetY(vector), DirectX::XMVectorGetZ(vector)); } But since it worked I thought it was very weird. I had it there since it were a while ago since I worked with the project (a month I think) and I have now learnt a bit more about operator overloading.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!