So I want to create one of these in my directX11 project.

The little axis there that shows you the direction.
I have a nice 3d shader for my world geometry that I tweaked from Frank D. Luna (He writes books on directX.) and another for my 2D UI so I thought I'd look at those and see what I could conjure up since I didn't know all that much about shaders to begin with. But this is what I came up with.
float4x4 gWorldViewProj;
Texture2D gDiffuseMap;
SamplerState samLinear
{
Filter = MIN_MAG_MIP_LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};
struct VertexIn
{
float3 PosL : POSITION;
float3 NormalL : NORMAL;
float2 Tex : TEXCOORD;
};
struct VertexOut
{
float4 PosH : SV_POSITION;
float2 Tex : TEXCOORD;
};
VertexOut VS(VertexIn vin)
{
VertexOut vout;
// Transform to homogeneous clip space.
vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);
// There are no transformations for texture coordinates.
vout.Tex = vin.Tex;
return vout;
}
float4 PS(VertexOut pin, uniform bool gUseTexure, uniform bool gAlphaClip) : SV_Target
{
// Default to multiplicative identity.
float4 texColor = float4(1, 1, 1, 1);
if (gUseTexure)
{
// Sample texture.
texColor = gDiffuseMap.Sample(samLinear, pin.Tex);
if (gAlphaClip)
{
// Discard pixel if texture alpha < 0.1.
clip(texColor.a - 0.1f);
}
}
return texColor;
}
This code works if I pass in a quad and render a texture too it. Then for gWorldViewProj I give it just the world matrix of the UI. Renders fine.
But when I tried it with 3D objects (anything that wasn't a quad.) nothing would render. The only way I could get it to render is by passing in world * view * proj but then it rotates around the scene when you look around because of the view matrix.
So the obvious work around was to create a view matrix with no transformations and that worked.
I thought I could just give it a world matrix since that's what I did with the 2D UI. I also tried world * proj but no prevail. Why does this shader only render quads without a view matrix but can't render other more complex sets of geometry without the view matrix?. Here is how I generated the quad.