DirectX 11 Overlay

2d, directx, directx-11, matrix, overlay

Solution

Basically, since you use dx11, you use shaders to render your elements.

So standard 3d objects generally follow this guideline: -Use 3 transforms : world (position object), view (transform in camera space), projection (transform in screen space).

In you vertex shader you multiply all that lot to convert from 3d to 2d.

Since now what you want is to display your elements in 2d (non relative to camera), you can easily create a new shader that doesn't take view/projection into account, so you just don't use those matrices in your vertex shader. (you can still use world for 2d transformation).

That's pretty much the easiest way, if you need pixel precise 2d elements, you need to create a billboard transform/shader. Basically you have your render target resolution, and standard render space is -1 -> 1, so you modify scale/translation to convert between both of those spaces.

When you render you overlay, also ensure that you disable depth completely.

If you need sample let me know I'll make one up quickly, but it should be quite simple.

Problem

I'm writing a DirectX 11 overlay for a game. Creating textures is quite simple and I have good knowledge of C/C++. The problem I am having is in my test window I can print the texture but as soon as I change the camera angle the texture moves with it. That is what most people want. What I want to know is how do I print something in 2D to always appear on screen whether the camera moves or not?

Original source