0
\$\begingroup\$

I am using the NVIDIA cubemap tool to generate my .dds file in Photoshop but I am unexpected results when the texture is loaded into my application.

I'm unsure as to whether this is caused by my code, or the texture generation in Photoshop. Does anyone know why this is happening?

https://i.gyazo.com/ea5c1022aa1ffb40feea50456d0d2fd0.jpg

https://i.gyazo.com/d639162c05059b9c6d011fde59d128c2.jpg

The texture is being applied to a sphere and it seems to only be stretching down the centre of the sphere, the rest is ok.

The code I am using to generate the resource view

D3DX11_IMAGE_LOAD_INFO loadSMInfo;
    loadSMInfo.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
    loadSMInfo.BindFlags = D3DX11_DEFAULT;
    loadSMInfo.Depth = D3DX11_DEFAULT;
    loadSMInfo.Filter = D3DX11_DEFAULT;
    loadSMInfo.FirstMipLevel = D3DX11_DEFAULT;
    loadSMInfo.MipFilter = D3DX11_DEFAULT;
    loadSMInfo.MipLevels = D3DX11_DEFAULT;


    ID3D11Texture2D* SMTexture = 0;
    hr = D3DX11CreateTextureFromFile(_pd3dDevice, L"assets/textures/skybox/sky.dds",
        &loadSMInfo, 0, (ID3D11Resource**)&SMTexture, 0);

    D3D11_TEXTURE2D_DESC SMTextureDesc;
    SMTexture->GetDesc(&SMTextureDesc);

    D3D11_SHADER_RESOURCE_VIEW_DESC SMViewDesc;
    SMViewDesc.Format = SMTextureDesc.Format;
    SMViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
    SMViewDesc.TextureCube.MipLevels = SMTextureDesc.MipLevels;
    SMViewDesc.TextureCube.MostDetailedMip = 0;


    ID3D11ShaderResourceView * smrv;
    hr = _pd3dDevice->CreateShaderResourceView(SMTexture, &SMViewDesc, &fullcubemap);

Edit: I have changed the sphere to a cube and the texture is looking better quality on two of the faces, but the other faces are stretched and distorted. I'm going to try another texture.

https://i.gyazo.com/6d4556bd79b0e3adce156e631fb2f514.mp4

Edit: I believe the problem is in my shader, forgetting to set the w value on the position to 1.0f.

https://i.gyazo.com/e1fd41679e2257920aebff8d4c766118.mp4

Perhaps the only problem left is a wrong texture image?

\$\endgroup\$
6
  • \$\begingroup\$ Have you tried existing ones? \$\endgroup\$
    – Sidar
    Aug 7, 2017 at 16:51
  • \$\begingroup\$ @Sidar I have not found any pre-made .dds cubemaps, but I have created multiple myself with two different tools (DxTex and NVIDIA tools for Photoshop), both produce the same issue. \$\endgroup\$
    – user
    Aug 7, 2017 at 17:02
  • \$\begingroup\$ I understood you made them yourself, so to make sure that your code is ok try existing ones first if you can find any though. Do they have to be dds? \$\endgroup\$
    – Sidar
    Aug 7, 2017 at 18:02
  • \$\begingroup\$ @Sidar Yeah I understood what you were getting at but I couldn't find any pre-made .dds files. For my setup, yes they have to be dds \$\endgroup\$
    – user
    Aug 7, 2017 at 18:39
  • \$\begingroup\$ Even turned existing skyboxes to dds? \$\endgroup\$
    – Sidar
    Aug 7, 2017 at 18:46

0

You must log in to answer this question.

Browse other questions tagged .