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

menohack

Members
  • Content count

    35
  • Joined

  • Last visited

Community Reputation

216 Neutral

About menohack

  • Rank
    Member
  1. Are you transforming cameraPos?   If you were using visual studio 2012 you could debug the shader and inspect values after it runs.
  2. I think it only allocates memory on the GPU. There is no reason to mirror data in CPU RAM as well. Also, you are more likely to have more RAM than GPU memory.
  3. D3DReadFileToBlob loads from a file to a ID3DBlob, but it looks like it is only available for D3D11. I don't know if you can just fopen and fread the .cso file, but you can definitely compile at run-time the first time and just write the blob to a file. Then the next time your program runs you can just fopen the compiled file.   If you have to go with the second way then you can still have visual studio compile your shaders to make sure they are correct at build-time. You just won't actually use the object files that it produces.
  4. The whiteness looks like your specularity is too high (if materialPower is too big) and the darkness is something you should expect from a point light. The brightness decreases with the square of the distance. So it may be the case that it is just falling off too quickly from lightRange being too small.   VS_OUTPUT and PS_INPUT are the same thing--use a typedef or just use one of them to avoid mistakes.
  5. It was from SV_POSITION. It used to be VPOS in D3D9.   http://msdn.microsoft.com/en-us/library/windows/desktop/bb509647(v=vs.85).aspx#VPOS   Also I recommend using visual studio 2012 and compiling offline. My solution used to take 15 seconds to load because it compiled the shaders at run-time. I didn't have that many shaders. I switched to offline compiling and the screen comes up in under a second. It's huge for productivity. And according to some guy I'm not going to cite there's no real advantage to compiling at run-time since it increases loading by so much.
  6. Solved it! My geometry shader was producing front caps and back caps with inverted normals. This caused the stencil count to be off because front faces increment and back faces decrement.   For future reference, the way mhagain set up the DepthStencil is the correct way. The front-facing shadow polygons could increment and the back-facing polygons could decrement, but it doesn't matter. The depth test should be LESS, so that failures are equal to or greater than the depth buffer.   The accidental inverted normal is like the missed decimal place for graphics programmers: http://www.youtube.com/watch?v=IPLnYP9Oo8s
  7. It sounds like your are forgetting to set your world matrix properly in between draw calls for your grid and your text. If you don't update the constant buffers on the cpu or the gpu with VSSetConstantBuffers then they will remain the way they were set for the previous draw call.
  8. If you are in debug mode for D3D then there should be warnings or errors in the output window of Visual Studio.
  9. Just for future reference: I believe that the Shader Debugger in Visual Studio 2012 can also check the stencil buffer.
  10. DX11

    You don't rotate billboards. Billboards always face the camera because they are just 2-D sprites. The only matrix you need to store per instance in your instance buffer is the world matrix. This matrix will have the position and scale of the billboards, such that the further it is the smaller it gets.   Anyway for instancing models this is what I do: #define NUM_MAX_INSTANCES 128 struct InstanceBuffer { XMFLOAT4X4 InstanceWorld[NUM_MAX_INSTANCES]; }; Then my shaders (note this is a normal model, not a billboard) look something like this: PS_INPUT VS( VS_INPUT input, uint iid : SV_InstanceID) { PS_INPUT output = (PS_INPUT)0; output.Pos = mul( input.Pos, InstanceWorld[iid] ); output.Pos = mul( output.Pos, View ); output.Pos = mul( output.Pos, Projection ); output.Norm = mul(float4(input.Norm, 0), InstanceWorld[iid] ).xyz; output.Tex = input.Tex; return output; } #define NUM_MAX_INSTANCES 128 cbuffer InstanceBuffer : register(b1) { matrix InstanceWorld[NUM_MAX_INSTANCES]; } Someone else can chime in with the max size of the instance buffer. I just guessed 128 for now.   Any time I need to render a batch of instanced models I call UpdateSubresource() with my new instance buffer and then DrawInstanced(). For drawing thousands of models I would probably have multiple DrawInstanced() calls, but I don't know if there is a better way.
  11. Exactly what I needed. Thank you very much!
  12. Is it possible to display the stencil buffer as a texture? The only formats available to a shader resource view are DXGI_FORMAT_R24_UNORM_X8_TYPELESS and DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS. When I try to draw this as a quad I only seem to have access to the x or r component, which is the depth.   Thanks!
  13. Yeah I'm doing all of those things. Like I said, Z-pass works. That implies that I have culling disabled. I use a stencil ref of 127 and clear to that as well. It may be worth using the saturate option for the stencil operation but it shouldn't be a problem for my simple test case.   I've been trying to get this for weeks and I just can't figure it out. There has to be something going on behind the scenes that I'm missing.   I've attached a picture of Z-pass working and what happens when I try z-fail using StencilDepthFailOp = INCR/DECR and DepthFunc = LESS. Note that StencilDepthFailOp is KEEP for z-pass and StencilPassOp is INCR/DECR instead.   The third image is when I set DepthFunc to GREATER_EQUAL and StencilDepthFailOp to INCR/DECR. This should be another method of z-pass because I have inverted the depth function. Now values that are less than the depth value will fail the depth test and cause the stencil value to change. But I can't explain the squares of grey pixels around the chair. Is D3D doing the depth test at a lower resolution, then using that decision for a whole square of fragments? I can't think of any other reason why those little grey squares would appear.   One place where I am confused by the API: what happens if the depth AND the stencil tests fail? There is a case for the depth fail operation and a case for the stencil fail operation. Which one occurs?   I appreciate the replies mhagain.
  14. That makes sense but it doesn't work. It makes the floor black except where geometry is behind the floor. Don't I need to change DepthFunc to GREATER? I want only fragments behind the depth map to be counted. Even when I try that it doesn't work.
  15. I have Z-pass working for my D3D11 application but no matter what I try I can't get z-fail to work. Here is my depth stencil state for building the stencil buffer with z-pass: D3D11_DEPTH_STENCIL_DESC depthStencilDesc = {0}; depthStencilDesc.DepthEnable = true; //Disable depth writes when rendering the volumes depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS; depthStencilDesc.StencilEnable = true; depthStencilDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; depthStencilDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; //Stencil operation for front-facing polygons should increment depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_INCR; depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; //Stencil operation for back-facing polygons should decrement depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_DECR; depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; hr = g_pd3dDevice->CreateDepthStencilState(&depthStencilDesc, &buildShadowVolumeDepthStencilState); How would I modify this to do z-fail?