DirectX11 Loaded texture colour becomes more saturated

Viewed 13

I'm loading an image to the screen using DirectX11, but the image becomes more saturated. Left is the loaded image and right is the original image.

enter image description here

Strange thing is that this happens only when I'm loading large images. The resolution of the image I'm trying to print is 1080 x 675 and my window size is 1280 x 800. Also, although the original image has a high resolution the image becomes a little pixelated. This is solved if I use LINEAR filter but I'm curious why this is happening. I'm fairly new to DirectX and I'm struggling..

Vertex layout:

D3D11_INPUT_ELEMENT_DESC elementDesc[] = {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
        { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
        { "TEXTURE", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0},
    };

Sampler state:

 D3D11_SAMPLER_DESC samplerDesc;
    ZeroMemory(&samplerDesc, sizeof(samplerDesc));
    samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    device->CreateSamplerState(&samplerDesc, &g_defaultSS);

Vertex shader:

struct VS_IN
{
    float3 p : POSITION; 
        float4 c : COLOR;
    float2 t : TEXTURE;
};

struct VS_OUT
{
    float4 p : SV_POSITION;
    float4 c : COLOR0;
    float2 t : TEXCOORD0;
};

VS_OUT VSMain(VS_IN input) 
{
    VS_OUT output = (VS_OUT)0;
    output.p = float4(input.p, 1.0f);
    output.c = input.c;
    output.t = input.t;
    return output;
}

Pixel shader:

Texture2D     g_texture         : register(t0);
SamplerState  g_sampleWrap      : register(s0);
float4 PSMain(VS_OUT input) : SV_Target
    {
        float4 vColor = g_texture.Sample(g_sampleWrap, input.t);    
        return vColor * input.c;
    }
0 Answers
Related