0

I'm trying to load texture from .jpg file with function CreateWICtextureFromFile from DirectX Tool kit. My image gets loaded as texture but the output has jitter and missing information. This are my code snpshots

    D3D11_SAMPLER_DESC samplerdesc;
    samplerdesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    samplerdesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerdesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerdesc.MipLODBias = 0.0f;
    samplerdesc.MaxAnisotropy = 1;
    samplerdesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    samplerdesc.BorderColor[0] = 0.5;
    samplerdesc.BorderColor[1] = 0.5;
    samplerdesc.BorderColor[2] = 0.5;
    samplerdesc.BorderColor[3] = 0.5;
    samplerdesc.MinLOD = 0;
    samplerdesc.MaxLOD = D3D11_FLOAT32_MAX;

    Device->CreateSamplerState(&samplerdesc, &samplestate);

===================================

DirectX::CreateWICTextureFromFile(Device, L"xyz.jpg", nullptr, &resourceview);

===================================

Pixel shader file

    texcolor = shader.Sample(Sample, tex);
    texcolor.w=0;
    return  textureColor;

===============================

    texDesc.Width = width;
    texDesc.Height = height;
    texDesc.MipLevels = 1;
    texDesc.ArraySize = 1;
    texDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
    texDesc.SampleDesc.Count = 1;
    texDesc.Usage = D3D11_USAGE_DEFAULT;
    texDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
    texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; 
  • It seems to me that you might have a problem with texture coordinates supplied to the vertex shader – VuVirt Aug 25 '21 at 17:06
  • Check for failures in the ``HRESULT`` return values. If ``CreateWICTextureFromFile`` succeeded, then it loaded fine and it's likely an issue with rendering or model data. – Chuck Walbourn Aug 25 '21 at 17:43
  • It would help if you provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). If you like you may send me zip of the example to email (my first and last names separated by period at google.com) or just share it so that I could take a look . – Damir Tenishev Aug 25 '21 at 21:29
  • @harryporter, I would again suggest providing [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). Please read the web page. This means, to create a simple project with the issue which you can share and which contains all the information necessary to run and debug: source code, data, solution files (*.sln). At the moment I can't see it in the updated question. – Damir Tenishev Aug 27 '21 at 21:40

0 Answers0