
Advertisement
DX11 ID3D11Query reporting weird results
By
maxest
, in Graphics and GPU Programming

Advertisement

Advertisement

Popular Tags

Advertisement

Popular Now

Similar Content

By trojanfoe
Hi there, this is my first post in what looks to be a very interesting forum.
I am using DirectXTK to put together my 2D game engine but I would like to have a scene graph where each entity has its own transform that is multiplied from its parent, which is pretty traditional I think. However how do I use SpriteBatch with my own world transform? I would also like to use the GPU depth buffer in order to avoid sorting backtofront as well as by texture as well as GPU instancing (I think) so am I looking at implementing my own sprite rendering?
Thanks in advance!

By Matt_Aufderheide
I am trying to draw a screenaligned quad with arbitrary sizes.
currently I just send 4 vertices to the vertex shader like so:
pDevCon>IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
pDevCon>Draw(4, 0);
then in the vertex shader I am doing this:
float4 main(uint vI : SV_VERTEXID) : SV_POSITION
{
float2 texcoord = float2(vI & 1, vI >> 1);
return float4((texcoord.x  0.5f) * 2, (texcoord.y  0.5f) * 2, 0, 1);
}
that gets me a screensized quad...ok .. what's the correct way to get arbitrary sizes?...I have messed around with various numbers, but I think I don't quite get something in these relationships.
one thing I tried is:
float4 quad = float4((texcoord.x  (xpos/screensizex)) * (width/screensizex), (texcoord.y  (ypos/screensizey)) * (height/screensizey), 0, 1);
.. where xpos and ypos is number of pixels from upper right corner..width and height is the desired size of the quad in pixels
this gets me somewhat close, but not right.. a bit too small..so I'm missing something ..any ideas?
.

By Stewie.G
Hi,
I've been trying to implement a gaussian blur recently, it would seem the best way to achieve this is by running a bur on one axis, then another blur on the other axis.
I think I have successfully implemented the blur part per axis, but now I have to blend both calls with a proper BlendState, at least I think this is where my problem is.
Here are my passes:
RasterizerState DisableCulling { CullMode = BACK; }; BlendState AdditiveBlend { BlendEnable[0] = TRUE; BlendEnable[1] = TRUE; SrcBlend[0] = SRC_COLOR; BlendOp[0] = ADD; BlendOp[1] = ADD; SrcBlend[1] = SRC_COLOR; }; technique11 BlockTech { pass P0 { SetVertexShader(CompileShader(vs_5_0, VS())); SetGeometryShader(NULL); SetPixelShader(CompileShader(ps_5_0, PS_BlurV())); SetRasterizerState(DisableCulling); SetBlendState(AdditiveBlend, float4(0.0, 0.0, 0.0, 0.0), 0xffffffff); } pass P1 { SetVertexShader(CompileShader(vs_5_0, VS())); SetGeometryShader(NULL); SetPixelShader(CompileShader(ps_5_0, PS_BlurH())); SetRasterizerState(DisableCulling); } }
D3DX11_TECHNIQUE_DESC techDesc; mBlockEffect>mTech>GetDesc( &techDesc ); for(UINT p = 0; p < techDesc.Passes; ++p) { deviceContext>IASetVertexBuffers(0, 2, bufferPointers, stride, offset); deviceContext>IASetIndexBuffer(mIB, DXGI_FORMAT_R32_UINT, 0); mBlockEffect>mTech>GetPassByIndex(p)>Apply(0, deviceContext); deviceContext>DrawIndexedInstanced(36, mNumberOfActiveCubes, 0, 0, 0); } No blur
PS_BlurV
PS_BlurH
P0 + P1
As you can see, it does not work at all.
I think the issue is in my BlendState, but I am not sure.
I've seen many articles going with the render to texture approach, but I've also seen articles where both shaders were called in succession, and it worked just fine, I'd like to go with that second approach. Unfortunately, the code was in OpenGL where the syntax for running multiple passes is quite different (http://rastergrid.com/blog/2010/09/efficientgaussianblurwithlinearsampling/). So I need some help doing the same in HLSL :)
Thanks!

By Fleshbits
Back around 2006 I spent a good year or two reading books, articles on this site, and gobbling up everything game dev related I could. I started an engine in DX10 and got through basics. I eventually gave up, because I couldn't do the harder things.
Now, my C++ is 12 years stronger, my mind is trained better, and I am thinking of giving it another go.
Alot has changed. There is no more SDK, there is evidently a DX Toolkit, XNA died, all the sweet sites I used to go to are 404, and google searches all point to Unity and Unreal.
I plainly don't like Unity or Unreal, but might learn them for reference.
So, what is the current path? Does everyone pretty much use the DX Toolkit? Should I start there? I also read that DX12 is just expert level DX11, so I guess I am going DX 11.
Is there a current and up to date list of learning resources anywhere? I am about tired of 404s..

By Stewie.G
Hi,
I've been trying to implement a basic gaussian blur using the gaussian formula, and here is what it looks like so far:
float gaussian(float x, float sigma)
{
float pi = 3.14159;
float sigma_square = sigma * sigma;
float a = 1 / sqrt(2 * pi*sigma_square);
float b = exp(((x*x) / (2 * sigma_square)));
return a * b;
}
My problem is that I don't quite know what sigma should be.
It seems that if I provide a random value for sigma, weights in my kernel won't add up to 1.
So I ended up calling my gaussian function with sigma == 1, which gives me weights adding up to 1, but also a very subtle blur.
Here is what my kernel looks like with sigma == 1
[0] 0.0033238872995488885
[1] 0.023804742479357766
[2] 0.09713820127276819
[3] 0.22585307043511713
[4] 0.29920669915475656
[5] 0.22585307043511713
[6] 0.09713820127276819
[7] 0.023804742479357766
[8] 0.0033238872995488885
I would have liked it to be more "rounded" at the top, or a better spread instead of wasting [0], [1], [2] with values bellow 0.1.
Based on my experiments, the key to this is to provide a different sigma, but if I do, my kernel values no longer adds up to 1, which results to a darker blur.
I've found this post
... which helped me a bit, but I am really confused with this the part where he divide sigma by 3.
Can someone please explain how sigma works? How is it related to my kernel size, how can I balance my weights with different sigmas, ect...
Thanks :)


Advertisement