• 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.


  • Content count

  • Joined

  • Last visited

Community Reputation

310 Neutral

About Sturmh

  • Rank

Personal Information

  • Location
  1. Nevermind. I solved this, I didnt see this post http://www.gamedev.net/topic/603052-slimdx-direct3d10-depth-buffer-only-works-backwards/ which prompted me to check my perspective projection matrix. I had the near and far plane's flipped.
  2. I am doing some terrain rendering and I've run in the some troubles. At this point in time I am just tessellating vertex patches then displacing them with a height map. My current problem is that the rendering looks pretty funky. I've been debugging this for a while and it looks like it is a problem with the depth buffer. Past that, I don't really have any ideas on what is happening.            Here's what visual studio says is going on with the depth buffer (different scene). Wasnt really sure the best way to show this using the debugger so I grabbed an image of the red channel and the green channel Note: The top left of this image is actually a similar depth to the bottom area of the image     Here's backbuffer:   As I understanding it, closer pixels should be colored darker than further pixels. As you can see when comparing the second and third images, it seems like the opposite is happening. Am i misunderstanding something or is something weird happening.   Any thoughts or pointing in a direction would be very appreciated since I'm out of ideas.     I'll also post how I am setting up my depth buffer for possible questions: D3D11_DEPTH_STENCIL_DESC dsdesc;     ZeroMemory(&dsdesc, sizeof(dsdesc));     dsdesc.DepthEnable = true;     dsdesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;     dsdesc.DepthFunc = D3D11_COMPARISON_LESS;     dsdesc.StencilEnable = true;     dsdesc.StencilReadMask = 0xFF;     dsdesc.StencilWriteMask = 0xFF;     dsdesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;     dsdesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;     dsdesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;     dsdesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;     dsdesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;     dsdesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;     dsdesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;     dsdesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;     HR(_device->CreateDepthStencilState(&dsdesc, &_depthStencilState));          D3D11_RASTERIZER_DESC rd;     rd.AntialiasedLineEnable = false;     rd.CullMode = D3D11_CULL_BACK;     rd.DepthClipEnable = true;     rd.DepthBias = 0;     rd.DepthBiasClamp = 0.0f;     rd.FillMode = D3D11_FILL_SOLID;     rd.FrontCounterClockwise = false;     rd.MultisampleEnable = false;     rd.ScissorEnable = false;     rd.SlopeScaledDepthBias = 0.0f;      
  3. Just want to make sure I understand what you are describing so I'll write up a bit of pseudo code.   Texture2D texA = CreateTexture(); Texture2D texB = CreateTexture(); RenderTarget texARTV = CreateRenderTarget(texA); ShaderResource texASRV = CreateShaderResource(texA); RenderTarget texBRTV = CreateRenderTarget(texB); ShaderResource texBSRV = CreateShaderResource(texB); // then when rendering // pass 1 SetRenderTarget(texARTV); SetShaderResource(texBSRV); draw() //pass 2 SetRenderTarget(texBRTV); SetShaderResource(texASRV); draw() ... and so on?
  4. As I understand it you cant bind the a texture as a render target and a shaderresource at the same time. How does one typically handle the situation where you want to render to a texture but sample that same texture in the render to texture operation. The reasoning would be if you need to use the previous value in the texture in the new value being written.The only way I could think of was to duplicate your texture and use one as the render target every frame and the other as the resource. Once the render is complete, copy the render target to the resource view.   Thought?  
  5. Well I figured out what the problem was. It was my HR macro that I was using around the map call. [Code] #define HR(x) \ { \ HRESULT hr = (x); \ if(FAILED(x)) \ { \ DXTrace(__FILE__, (DWORD)__LINE__, hr, L#x, true); \ } \ } [/Code] No Idea why this was causing the issue with map, but everything seems to work once i removed it.
  6. I changed up the program to see if some other part of my code was indirectly causing the mapping issue. Now, all I am doing is initializing D3D then calling this [Code] //Fill out texture desc D3D11_TEXTURE2D_DESC td; td.ArraySize = 1; td.BindFlags = D3D11_BIND_SHADER_RESOURCE; td.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; td.Format = DXGI_FORMAT_B8G8R8A8_UNORM; td.Height = 500; td.MipLevels = 1; td.MiscFlags = 0; td.SampleDesc.Count = 1; td.SampleDesc.Quality = 0; td.Usage = D3D11_USAGE_DYNAMIC; td.Width = 500; HR(device->CreateTexture2D(&td, 0, &m_texture)); D3D11_MAPPED_SUBRESOURCE mappedResource; HR(dc->Map(m_texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)); BYTE* mappedData = reinterpret_cast<BYTE*>(mappedResource.pData); for(UINT i = 0; i < m_buffer.height; ++i) { memcpy(mappedData, m_buffer.buffer, m_buffer.rowspan); mappedData += mappedResource.RowPitch; m_buffer.buffer += m_buffer.rowspan; } dc->Unmap(m_texture, 0); [/Code] And I am getting the "already mapped error." Now I am really confused. How can it be already mapped if this the first and only map call I am making. To quote msdn for initializing a dynamic texture [Quote] [b]Dynamic Usage[/b] To fill a dynamic texture (one created with D3D11_USAGE_DYNAMIC): [list=1][*]Get a pointer to the texture memory by passing in D3D11_MAP_WRITE_DISCARD when calling [url="http://msdn.microsoft.com/en-us/library/ff476457%28v=vs.85%29.aspx"][b]ID3D11DeviceContext::Map[/b][/url].[*]Write data to the memory.[*]Call [url="http://msdn.microsoft.com/en-us/library/ff476485%28v=vs.85%29.aspx"][b]ID3D11DeviceContext::Unmap[/b][/url] when you are finished writing data[/list] [/Quote] Thats exactly what you guys are telling me and what I am doing haha. Could it be possible that I am initializing my devices incorrectly? Edit: Tried it on a different computer and also got out of memory error, so pretty obvious now that im doing something wrong haha.
  7. for the lib, try linking to ..\Lib\x86 instead of just \Lib. I was able to recreate your issued in VS2010 with d3dx10.lib. In the VC++ directories->Library Directories I changed mine to $(DXSDK_DIR)Lib then restarted VS and got the linking error. I changed it back to what i had, $(DXSDK_DIR)Lib\x86 and it worked fine.
  8. To expand on what I said previously, could I be using the Subresource parameter of the map call incorrectly? I dont really understand what that corresponds to. I dont know if this is correct but I am using the same subresource parameter when mapping the buffer to the texture as when I map my constant buffer for the vertex shader. This is the only other map call in the program. I dont know if posting this code will be any help, but it wont hurt: [Code] //Lock constant buffer to write to it HR(deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResources)); //Get point to data in constant buffer matrixBuffer = (MatrixBuffer*)mappedResources.pData; matrixBuffer->world = world; matrixBuffer->view = view; matrixBuffer->proj = proj; //Unlock constant buffer after done writing to it deviceContext->Unmap(m_matrixBuffer, 0); //Set contant buffer in the vertex shader with new values deviceContext->VSSetConstantBuffers(0, 1, &m_matrixBuffer); //Set shader texture resource in the pixel shader deviceContext->PSSetShaderResources(0, 1, &m_textureRV); [/Code] Edit: Hmm, I just noticed when I comment out the map call to update the texture I still get: D3D11: ERROR: ID3D11DeviceContext::Map: This resource is already mapped! [ RESOURCE_MANIPULATION ERROR #2097213: RESOURCE_MAP_ALREADYMAPPED ] This also happens when I comment out the map call for updating the constant buffer and running the map call updating the texture; I would seem all my attempts to use the map function are not working out to well. Some additional understanding of how to properly use of the map function, if I am indeed using it incorrectly, would be greatly appreciated.
  9. [quote name='MJP' timestamp='1310677463' post='4835435'] [quote name='Sturmh' timestamp='1310669951' post='4835383'] Additionally, every time i call map here, the D3D debug output says "Error:......Resource is already mapped" or something of the sort. [/quote] Well that definitely sounds like your problem. The driver is probably continuing to allocate hidden textures behind the scenes (since that's what they do to avoid stalling when updating dynamic resources), and not freeing them because you're not unmapping them. [/quote] Sorry but I am still a little confused. How do I free these hidden textures haha. I'm not really sure where I should be looking to try and fix this. Could I be using incorrect parameters for the Map and Unmap calls. Also, could it be my code to render, even though I have pinpointed the "Resource already mapped" error. I'm just stumped haha.
  10. [quote name='MJP' timestamp='1310668864' post='4835371'] [quote name='Sturmh' timestamp='1310580540' post='4834932'] Everything is working and I am updating the texture several times a second. After about 30 seconds or so I get a E_OUTOFMEMORY error from: [size="2"][Code]deviceContext->Map(m_texture, 0, D3D11_MAP_WRITE_DISCARD], 0, &mappedResource)[/Code][/size] All I am doing in my program is updating the texture, then drawing the texture on a quad. Could it be how I am updating my constant buffer and resource view for the shader that is causing this problem? I dont feel like that would be it assuming I was doing something incorrectly. [font="CourierNew, monospace"] [/font] [font="CourierNew, monospace"] [/font] [/quote] I've never heard of an out of memory error happening from mapping a resource. You're not creating any resources during the frame, are you? Also, did you remember to call Unmap after copying in the data? [/quote] No I am not. Each frame i call two functions, update() and render(). update -> update a buffer, check if it changed from last frame, and if it did, update the texture with: [Code] HR(deviceContext->Map(m_texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)); BYTE* mappedData = reinterpret_cast<BYTE*>(mappedResource.pData); for(UINT i = 0; i < m_renderBuffer.height; ++i) { memcpy(mappedData, m_renderBuffer.buffer, m_renderBuffer.rowspan); mappedData += mappedResource.RowPitch; m_renderBuffer.buffer += m_renderBuffer.rowspan; } deviceContext->Unmap(m_texture, 0); [/Code] Additionally, every time i call map here, the D3D debug output says "Error:......Resource is already mapped" or something of the sort. I know for a fact that the above map call is the cause of the "error" I ran it once with the texture size at about 300 x 150, as opposed to about 800 x 400, and I never encountered the E_OUTOFMEMORY problem,
  11. Everything is working and I am updating the texture several times a second. After about 30 seconds or so I get a E_OUTOFMEMORY error from: [size="2"][Code]deviceContext->Map(m_texture, 0, D3D11_MAP_WRITE_DISCARD], 0, &mappedResource)[/Code][/size] All I am doing in my program is updating the texture, then drawing the texture on a quad. Could it be how I am updating my constant buffer and resource view for the shader that is causing this problem? I dont feel like that would be it assuming I was doing something incorrectly. [font="CourierNew, monospace"] [/font] [font="CourierNew, monospace"] [/font]
  12. Ok I understand whats going on much better now. Thank you all for the help and the insight.
  13. [quote name='MJP' timestamp='1310492347' post='4834406'] The texture resource will have it's own pitch (the number of bytes in a row), which is probably different than the pitch of your source data. This pitch is given to you as the "RowPitch" member of D3D11_MAPPED_SUBRESOURCE. So typically you do something like this: [code] BYTE* mappedData = reinterpret_cast<BYTE*>(mappedResource.pData); for(UINT i = 0; i < height; ++i) { memcpy(mappedData, buffer, rowspan); mappedData += mappedResource.RowPitch; buffer += rowspan; } [/code] [/quote] Excellent, works perfectly. Except now I am curious why the pitch of the texture is different when I set the pitch in the D3D11_SUBRESOURCE_DATA description.
  14. So I am trying to update my buffer and after copying my new texture data in, the texture is rendered with a shearing effect. [Code] D3D11_MAPPED_SUBRESOURCE mappedResource; HR(deviceContext->Map(m_texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)); memcpy(mappedResource.pData, buffer, rowspan*height); deviceContext->Unmap(m_texture, 0); [/Code] I am pretty sure the buffer itself is not the issue because so my guess is it has something to do with my use of memcpy but i just do see it. I feel like I am being a little vague, but cant think of anything else to say haha. I can try to elaborate if need be.
  15. Thanks for the help. I think I got it all figured out.