# DDS load texture and cubemaps

I'm trying to render a skybox with a cubemap on it and to do so I'm using DDS Texture Loader from DirectXTex library. I use texassemble to generate the cubemap (texture array of 6 textures) into a DDS file that I load at runtime. I generated a cube "dome" and sample the texture using the position vector of the vertex as the sample coordinates (so far so good), but I always get the same face of the cubemap mapped on the sky. As I look around I always get the same face (and it wobbles a bit if I move the camera). My code:

//Texture.cpp:

Texture::Texture(const wchar_t *textureFilePath, const std::string &textureType) : mType(textureType)
{
}

// SkyBox.cpp:

void SkyBox::Draw()
{
// set cube map

// set primitive topology
Game::GetInstance()->GetDeviceContext()->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

mMesh.Bind();
mMesh.Draw();
}

cbuffer Transform : register(b0)
{
float4x4 viewProjectionMatrix;
};

float4 main(inout float3 pos : POSITION) : SV_POSITION
{
return mul(float4(pos, 1.0f), viewProjectionMatrix);
}

SamplerState cubeSampler;
TextureCube cubeMap;

float4 main(in float3 pos : POSITION) : SV_TARGET
{
float4 color = cubeMap.Sample(cubeSampler, pos.xyz);
return color;
}


I tried both functions grom DDS loader but I keep getting the same result. All results I found on the web are about the old SDK toolkits, but I'm using the new DirectXTex lib.

• Your comment says "vertex shader" but you've actually posted your pixel shader; can you post your actual vertex shader please? There is most likely an issue with the position you pass from it to the pixel shader. – Maximus Minimus Apr 12 '18 at 9:29
• @MaximusMinimus Sorry, my mistake, I edited the post – Luca Apr 12 '18 at 9:35