• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Jo Nsc

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

119 Neutral

About Jo Nsc

  • Rank
    Newbie
  1. I would kiss you guys if i could, you where right! I added MinDepth and MaxDepth to the D3D11_VIEWPORT struct, everything works like intended now  .   TY! To everyone who wasted his time on a newbie like me :)
  2.   No, i just copied that from an example. I just disabled Stencil - nothing changed. I rly start to hate this shit. Already wasted over 20 Hours. 
  3. You where right, i actually forgot to set a depthStencilState at all. Unfortunately, it doesnt solve my problem.  I added this Code to my InitD3D Function: D3D11_DEPTH_STENCIL_DESC depthStencilDesc;   // Set up the description of the stencil state. depthStencilDesc.DepthEnable = true; depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;   depthStencilDesc.StencilEnable = true; depthStencilDesc.StencilReadMask = 0xFF; depthStencilDesc.StencilWriteMask = 0xFF;   // Stencil operations if pixel is front-facing. depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR; depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;   // Stencil operations if pixel is back-facing. depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR; depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;   // Create the depth stencil state. hr = dev->CreateDepthStencilState(&depthStencilDesc, &depthStencilState); if(FAILED(hr)) {    MessageBox(NULL, L"CreateDepthStencilState (depthstencilbuffer) failed", NULL, MB_OK); } // Set the depth stencil state. devcon->OMSetDepthStencilState(depthStencilState, 1); nothing changed. I tried a bit around and noticed something interesting: If i change depthStencilDesc.DepthFunc from D3D11_COMPARISON_LESS to D3D11_COMPARISON_GREATER, nothing is drawn at all. If i change it to D3D11_COMPARISON_ALWAYS, it seems like early drawn faces stay in front of later drawn surfaces.    Changing this depthStancilState DOES have an effect! But unfortunately, depth still doesnt work like intended.   Edit: One thing just came to my mind: maybe its terrible stupid but i dont care about depth in my shaders! Maybe thats the Problem? Do i have to handle this myself? Maybe inside of the Pixelshader?
  4. I tryed your zero-pointer advice, but backbuffer isnt set to NULL after OMSetRenderTargets. I tried it anyway, but no improvement, Its still ignoring depth. I also worked on that D3D-Debug messages, turned out i have some problems releasing all of my com-Objects. I am working on that, but i am pretty sure thats not the reason for my Problems with the depth-buffer. I give you my render function too, maybe you can spot a mistake there. I realy tried everything, but i dont get the depthbuffer working void RenderFrame(void) {    // Set the depth stencil state.     devcon->OMSetDepthStencilState(depthStencilState, 1);      //Clear our backbuffer    float bgColor[4] = {(1.0f, 0.0f, 0.0f, 1.0f)};    devcon->ClearRenderTargetView(backbuffer, bgColor);      //Refresh the Depth/Stencil view    devcon->ClearDepthStencilView(depthStencilView, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, 1.0f, 0);        // set the shader objects    devcon->VSSetShader(pVS, 0, 0);    devcon->PSSetShader(pPS, 0, 0);    devcon->IASetInputLayout(pLayout);    devcon->PSSetShaderResources( 0, 1, &TestTexture );      // render terrain    WVP = kamera.GetViewMatrix() * kamera.GetProjectionMatrix();    cbPerObj.WorldViewProjection = XMMatrixTranspose(WVP);    devcon->UpdateSubresource( cbPerObjectBuffer, 0, NULL, &cbPerObj, 0, 0 );    devcon->VSSetConstantBuffers( 0, 1, &cbPerObjectBuffer );      terrain.render(devcon);        // render cube    WVP = CubeWorld * kamera.GetViewMatrix() * kamera.GetProjectionMatrix();    cbPerObj.WorldViewProjection = XMMatrixTranspose(WVP);    devcon->UpdateSubresource( cbPerObjectBuffer, 0, NULL, &cbPerObj, 0, 0 );    devcon->VSSetConstantBuffers( 0, 1, &cbPerObjectBuffer );      UINT stride = sizeof( VERTEX );    UINT offset = 0;    devcon->IASetVertexBuffers( 0, 1, &pVBuffer, &stride, &offset );    devcon->IASetIndexBuffer( squareIndexBuffer, DXGI_FORMAT_R32_UINT, 0);    devcon->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );    devcon->DrawIndexed( 36, 0, 0 );        swapchain->Present(0, 0); }
  5. Hi Guys! I am new to DirectX, so excuse me if this is an easy to solve Problem, but i tried for hours now, and i just dont get it. I try to render some stuff with DirectX 11 (c++). Rendering works fine, but it just ignores the depth,  It draws everything in order of my draw call, meaning the last drawn stuff is visible. I enabled the DirectX debug mode, to get some Error-Information in my IDE, this it what it tells me: D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader unit expects a Sampler to be set at Slot 0, but none is bound. This is perfectly valid, as a NULL Sampler maps to default Sampler state. However, the developer may not want to rely on the defaults.  [ EXECUTION WARNING #352: DEVICE_DRAW_SAMPLER_NOT_SET] Der Thread 0x98c hat mit Code 0 (0x0) geendet. Der Thread 0x1bf0 hat mit Code 0 (0x0) geendet. Der Thread 0x53c hat mit Code 0 (0x0) geendet. D3D11 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Producer at 0x00CD310C, Refcount: 16. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CD8F28, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CE8208, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEE3FC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEE544, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEE6B4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEE904, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEEA4C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEEB98, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEF24C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEF5FC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEF944, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEFBBC, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEFD54, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CEFFC4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CF0234, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CF044C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CF05E4, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CF084C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D00184, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CF4C7C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D003EC, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D00DCC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CFDAE4, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00CFF71C, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D01044, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D012AC, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D57D44, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D50784, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D5091C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D50B94, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D50D2C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D50FA4, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D93594, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D937FC, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x00D0F594, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live                         Object :     35 [ STATE_CREATION WARNING #0: UNKNOWN] DXGI WARNING: Live Producer at 0x00CCF5F8, Refcount: 4. [ STATE_CREATION WARNING #0: ] DXGI WARNING: Live Object at 0x00CD1E20, Refcount: 2. [ STATE_CREATION WARNING #0: ] DXGI WARNING: Live                         Object :      1 [ STATE_CREATION WARNING #0: ] Das Programm "[916] tst.exe" wurde mit Code 0 (0x0) beendet. I dont think this warnings have anything to do with my Problem, but i am not 100% sure about that.   This is the Code for creating the backbuffer, depthstencilbuffer etc... void InitD3D(HWND hWnd) {   //Describe our SwapChain Buffer DXGI_MODE_DESC bufferDesc;   ZeroMemory(&bufferDesc, sizeof(DXGI_MODE_DESC));   bufferDesc.Width = SCREEN_WIDTH; bufferDesc.Height = SCREEN_HEIGHT; bufferDesc.RefreshRate.Numerator = 60; bufferDesc.RefreshRate.Denominator = 1; bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;      // create a struct to hold information about the swap chain    DXGI_SWAP_CHAIN_DESC scd;      // clear out the struct for use    ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));      // fill the swap chain description struct scd.BufferDesc = bufferDesc;    scd.BufferCount = 1;                                   // one back buffer    scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;     // how swap chain is to be used    scd.OutputWindow = hWnd;                               // the window to be used    scd.SampleDesc.Count = 1;                              // how many multisamples scd.SampleDesc.Quality = 0;    scd.Windowed = TRUE;                                   // windowed/full-screen mode    scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;    // allow full-screen switching   scd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // Discard the back buffer contents after presenting.       // create a device, device context and swap chain using the information in the scd struct    hr = D3D11CreateDeviceAndSwapChain(NULL,                                   D3D_DRIVER_TYPE_HARDWARE,                                   NULL,   D3D11_CREATE_DEVICE_DEBUG,                                   NULL,                                   NULL,                                   D3D11_SDK_VERSION,                                   &scd,                                   &swapchain,                                   &dev,                                   NULL,                                   &devcon); if(FAILED(hr)) { MessageBox(NULL, L"D3D11CreateDeviceAndSwapChain failed", NULL, MB_OK); }      // get the address of the back buffer ID3D11Texture2D *pBackBuffer;    swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);      // use the back buffer address to create the render target    hr = dev->CreateRenderTargetView(pBackBuffer, NULL, &backbuffer); if(FAILED(hr)) { MessageBox(NULL, L"CreateRenderTargetView (backbuffer) failed", NULL, MB_OK); }    pBackBuffer->Release(); pBackBuffer = 0;   // depth + stencil // Initialize the description of the depth buffer. D3D11_TEXTURE2D_DESC depthBufferDesc; ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));   // Set up the description of the depth buffer. depthBufferDesc.Width = SCREEN_WIDTH; depthBufferDesc.Height = SCREEN_HEIGHT; depthBufferDesc.MipLevels = 1; depthBufferDesc.ArraySize = 1; depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; depthBufferDesc.SampleDesc.Count = 1; depthBufferDesc.SampleDesc.Quality = 0; depthBufferDesc.Usage = D3D11_USAGE_DEFAULT; depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; depthBufferDesc.CPUAccessFlags = 0; depthBufferDesc.MiscFlags = 0; // Create the texture for the depth buffer using the filled out description. hr = dev->CreateTexture2D(&depthBufferDesc, NULL, &depthStencilBuffer); if(FAILED(hr)) { MessageBox(NULL, L"CreadeTexture2D (depthstencilbuffer) failed", NULL, MB_OK); } hr = dev->CreateDepthStencilView(depthStencilBuffer, NULL, &depthStencilView); if(FAILED(hr)) { MessageBox(NULL, L"CreateDepthStencilView (depthstencilbuffer) failed", NULL, MB_OK); }   //Set our Render Target devcon->OMSetRenderTargets( 1, &backbuffer, depthStencilView );   // Set the viewport    D3D11_VIEWPORT viewport;    ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT));      viewport.TopLeftX = 0;    viewport.TopLeftY = 0;    viewport.Width = SCREEN_WIDTH;    viewport.Height = SCREEN_HEIGHT;      devcon->RSSetViewports(1, &viewport);        InitPipeline();    InitGraphics(); }   I rly hope you can help me, since i rly start getting depressed over this. Sorry for my bad english, not my mother language.