Skip to main content
added 330 characters in body
Source Link
user
  • 155
  • 9
D3DX11CreateShaderResourceViewFromFile(_pd3dDevicedevice, L"cubemap.dds", 0, 0, &fullcubemap, 0); 

Still produces the same output, any ideas?

Edit: Tried increasing the zfar distance and the texture remains the exact same no matter what value I put.

Example with second texture with increased view distance. enter image description here

This texture is used on another object in my scene and comes out fine.

D3DX11CreateShaderResourceViewFromFile(_pd3dDevice, L"cubemap.dds", 0, 0, &fullcubemap, 0); 

Still produces the same output, any ideas?

D3DX11CreateShaderResourceViewFromFile(device, L"cubemap.dds", 0, 0, &fullcubemap, 0); 

Still produces the same output, any ideas?

Edit: Tried increasing the zfar distance and the texture remains the exact same no matter what value I put.

Example with second texture with increased view distance. enter image description here

This texture is used on another object in my scene and comes out fine.

added 1628 characters in body
Source Link
user
  • 155
  • 9

Initially I was planning to use this snippet to update the TextureCube variable in the shader

ID3DX11EffectShaderResourceVariable * cMap; cMap = skyboxShader->GetVariableByName("gCubeMap")->AsShaderResource(); cMap->SetResource(fullcubemap); 

But it seems that has no effect, and in fact, without the following line, the sphere I'm using for the cubemap textures with a texture used with another object in the scene, so perhaps there's something going on here? I'm not sure what though.

immediateContext->PSSetShaderResources(0, 1, &fullcubemap);//textures 

Edit: Probably not the above, realised that if this wasn't updated, the old texture would be applied as it's never wiped after each draw.

Edit: Tried the cubemap with both a sphere and a cube, still the same texture issue.

Edit: Tried loading the shader resource view differently

D3DX11_IMAGE_LOAD_INFO loadSMInfo; loadSMInfo.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE; ID3D11Texture2D* SMTexture = 0; hr = D3DX11CreateTextureFromFile(device, L"cubemap.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; hr = device->CreateShaderResourceView(SMTexture, &SMViewDesc, &fullcubemap); 

Still produces the same output, any ideas?

Initially I was planning to use this snippet to update the TextureCube variable in the shader

ID3DX11EffectShaderResourceVariable * cMap; cMap = skyboxShader->GetVariableByName("gCubeMap")->AsShaderResource(); cMap->SetResource(fullcubemap); 

But it seems that has no effect, and in fact, without the following line, the sphere I'm using for the cubemap textures with a texture used with another object in the scene, so perhaps there's something going on here? I'm not sure what though.

immediateContext->PSSetShaderResources(0, 1, &fullcubemap);//textures 

Edit: Probably not the above, realised that if this wasn't updated, the old texture would be applied as it's never wiped after each draw.

Edit: Tried the cubemap with both a sphere and a cube, still the same texture issue.

Edit: Tried loading the shader resource view differently

D3DX11_IMAGE_LOAD_INFO loadSMInfo; loadSMInfo.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE; ID3D11Texture2D* SMTexture = 0; hr = D3DX11CreateTextureFromFile(device, L"cubemap.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; hr = device->CreateShaderResourceView(SMTexture, &SMViewDesc, &fullcubemap); 

Still produces the same output, any ideas?

deleted 6 characters in body
Source Link
user
  • 155
  • 9
immediateContext->OMSetRenderTargets(1, &_pRenderTargetView&renderTarget, nullptr); XMMATRIX sworld, sview, sprojection; SkyboxConstantBuffer scb; sview = XMLoadFloat4x4(&_view); sprojection = XMLoadFloat4x4(&_projection); sworld = XMLoadFloat4x4(&_world); scb.world = sworld; scb.view = sview; scb.projection = sprojection; immediateContext->IASetIndexBuffer(cubeMapSphere->getIndexBuffer(), DXGI_FORMAT_R32_UINT, 0); ID3D11Buffer* vertexBuffer = cubeMapSphere->getVertexBuffer(); //ID3DX11EffectShaderResourceVariable * cMap; ////cMap = skyboxShader->GetVariableByName("gCubeMap")->AsShaderResource(); immediateContext->PSSetShaderResources(0, 1, &fullcubemap);//textures //cMap->SetResource(fullcubemap); immediateContext->IASetVertexBuffers(0, 1, &vertexBuffer, &stride, &offset); immediateContext->VSSetShader(skyboxVertexShader, nullptr, 0); immediateContext->VSSetConstantBuffers(0, 1, &skyboxConstantBuffer); immediateContext->PSSetConstantBuffers(0, 1, &skyboxConstantBuffer); immediateContext->PSSetShader(skyboxPixelShader, nullptr, 0); immediateContext->UpdateSubresource(skyboxConstantBuffer, 0, nullptr, &scb, 0, 0); immediateContext->DrawIndexed(cubeMapSphere->getIndexBufferSize(), 0, 0); 
immediateContext->OMSetRenderTargets(1, &_pRenderTargetView, nullptr); XMMATRIX sworld, sview, sprojection; SkyboxConstantBuffer scb; sview = XMLoadFloat4x4(&_view); sprojection = XMLoadFloat4x4(&_projection); sworld = XMLoadFloat4x4(&_world); scb.world = sworld; scb.view = sview; scb.projection = sprojection; immediateContext->IASetIndexBuffer(cubeMapSphere->getIndexBuffer(), DXGI_FORMAT_R32_UINT, 0); ID3D11Buffer* vertexBuffer = cubeMapSphere->getVertexBuffer(); //ID3DX11EffectShaderResourceVariable * cMap; ////cMap = skyboxShader->GetVariableByName("gCubeMap")->AsShaderResource(); immediateContext->PSSetShaderResources(0, 1, &fullcubemap);//textures //cMap->SetResource(fullcubemap); immediateContext->IASetVertexBuffers(0, 1, &vertexBuffer, &stride, &offset); immediateContext->VSSetShader(skyboxVertexShader, nullptr, 0); immediateContext->VSSetConstantBuffers(0, 1, &skyboxConstantBuffer); immediateContext->PSSetConstantBuffers(0, 1, &skyboxConstantBuffer); immediateContext->PSSetShader(skyboxPixelShader, nullptr, 0); immediateContext->UpdateSubresource(skyboxConstantBuffer, 0, nullptr, &scb, 0, 0); immediateContext->DrawIndexed(cubeMapSphere->getIndexBufferSize(), 0, 0); 
immediateContext->OMSetRenderTargets(1, &renderTarget, nullptr); XMMATRIX sworld, sview, sprojection; SkyboxConstantBuffer scb; sview = XMLoadFloat4x4(&_view); sprojection = XMLoadFloat4x4(&_projection); sworld = XMLoadFloat4x4(&_world); scb.world = sworld; scb.view = sview; scb.projection = sprojection; immediateContext->IASetIndexBuffer(cubeMapSphere->getIndexBuffer(), DXGI_FORMAT_R32_UINT, 0); ID3D11Buffer* vertexBuffer = cubeMapSphere->getVertexBuffer(); //ID3DX11EffectShaderResourceVariable * cMap; ////cMap = skyboxShader->GetVariableByName("gCubeMap")->AsShaderResource(); immediateContext->PSSetShaderResources(0, 1, &fullcubemap);//textures //cMap->SetResource(fullcubemap); immediateContext->IASetVertexBuffers(0, 1, &vertexBuffer, &stride, &offset); immediateContext->VSSetShader(skyboxVertexShader, nullptr, 0); immediateContext->VSSetConstantBuffers(0, 1, &skyboxConstantBuffer); immediateContext->PSSetConstantBuffers(0, 1, &skyboxConstantBuffer); immediateContext->PSSetShader(skyboxPixelShader, nullptr, 0); immediateContext->UpdateSubresource(skyboxConstantBuffer, 0, nullptr, &scb, 0, 0); immediateContext->DrawIndexed(cubeMapSphere->getIndexBufferSize(), 0, 0); 
added 2739 characters in body
Source Link
user
  • 155
  • 9
Loading
Source Link
user
  • 155
  • 9
Loading