• Create Account

Banner advertising on our site currently available from just \$5!

# keym

Member Since 08 Dec 2010
Offline Last Active Nov 24 2013 03:53 AM

### Deferred depth problem

30 April 2013 - 09:47 AM

Hi guys,

I'm struggling again with my deferred renderer. This time I'm rewriting it from OpenGL/Cg to DX11/HLSL. I have almost everything working but (I think) my reconstruction from depth is now working correctly (I compared normals and they look the same as in OGL renderer, so I guess they are fine). The result I get is somewhat correct but bad things start to happen when I move away from the lit object - It becomes darker and darker and eventually gets all black. The thing is that I use almost the same code as when dealing with Cg/OGL and perhaps I've overlooked something with conversion. Fun fact - walls that are closer to the camera gets darker quicker than walls that are further away - maybe this will give some hint.

Posting pics

```    //compute view space position
#define ZNEAR zNearZFar.x
#define ZFAR zNearZFar.y
#define A (ZNEAR + ZFAR)
#define B (ZNEAR - ZFAR)
#define C (2.0 * ZNEAR * ZFAR)
#define D (ndcPos.z * B)
#define ZEYE (-C / (A + D))
float3 ndcPos = (float3(texCoord.x, 1 - texCoord.y, depth2) - 0.5) * 2.0; //<<<Here I had to flip Y coord when compared to the OGL/Cg shader
float4 clipPos;
clipPos.w = -ZEYE;
clipPos.xyz = ndcPos * clipPos.w;
float3 vsPos = mul(invProj, clipPos).xyz;
```

### Aspect ratio for tall windows

08 April 2013 - 06:01 AM

Hello,

I'm having troubles with maintaining aspect ratio while my window is taller than wider. How do I readjust that in my perspective matrix? I calculate aspect ratio simply dividing width / height and it works great when window is wider than taller but the other way around my image is stretched. Any solutions to this? I make my perspective matrix using D3DXMatrixPerspectiveFovRH.

### Picking in DX11

24 March 2013 - 01:55 PM

Hello,

I'm trying to make picking working following this tutorial: http://www.rastertek.com/dx11tut47.html

I'm not sure is it me or the author confuses spaces at the end of this tutorial? Can someone have a fresh look at this? Namely he states that multyplying vector by inverse view matrix we get the result in view space. Shouldn't it be in world space? And then we go from world into object space and there make final test? His ray intersection doesn't take into account sphere position so final test looks like it's in object space, but he also says it's in world space... So yeah, thoughts?

### Texture from memory

06 March 2013 - 05:18 PM

Hello,

I have simple (I think) problem for all guys with D3D11 background - I already have working TGA loader and now I want to pass this raw data to D3D, create a texture and use it in shader. How do I do that? I googled and only tutorials/helpful tips I could find cover D3D loaders with D3DX11CreateShaderResourceViewFromFile. I can see that there's a D3DX11CreateShaderResourceViewFromMemory but I'm not sure how to use it - the texture appears black (I get E_FAIL result so I must be doing something wrong). What's the usual procedure? I would really appreciate a sample code or snippet, cause it's hard to find anything useful except msdn which is still kinda mystical to me.

### SLERP issues

12 February 2013 - 09:01 AM

So I implemented (finally) my GPU skinning and it works well when I iterate through all frames. It even works when I interpolate between frames of the same animation but I wanted to push it forward and make a simple weight based blending between animations. Here's the problem... Check out the video:

For this particular test I'm "slerping" current frame with bind pose frame at ratio 0%-50% (weight increases as I continue to play walk animation, I capped it to 50% because here is where the weird stuff is most noticable). When I SLERP between frameN and frameN+1 accordingly to the elapsed time, animation looks alright. The problem occurs when I try to blend two animations or animation with bind pose (as shown in the video). Ideas?

PARTNERS