D3D12纹理立方体的面渲染不正确。

huangapple go评论79阅读模式
英文:

D3D12 Textured Cube faces being rendered incorrectly

问题

我目前正在使用D3D12渲染一排带纹理的立方体,并且我注意到应该被遮挡的立方体的正面被渲染并覆盖了立方体。我该如何修复这个问题?我希望被遮挡的正面不可见。

谢谢。

D3D12纹理立方体的面渲染不正确。

D3D12纹理立方体的面渲染不正确。

英文:

I am currently working on rendering a row of textured cubes using D3D12, and I have noticed that the front face of the cubes that should be occluded is being rendered and covering the cube. How can I fix this? I want the occluded front faces to not be visible.

Thank you.

D3D12纹理立方体的面渲染不正确。

D3D12纹理立方体的面渲染不正确。

答案1

得分: 2

我刚刚检查了我的代码,发现在成功创建深度模板视图(DSV)后,我忘记将DSVHandle绑定到OMSetRenderTarget。绑定后,被遮挡的部分不再渲染。感谢大家的专业知识。 🤣

    pD3D12CommandList->OMSetRenderTargets(1, &RTVHandle, false, &DSVHandle);

    pD3D12CommandList->ClearDepthStencilView(pDSVHeap->GetCPUDescriptorHandleForHeapStart(), D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr);
英文:

I just checked my code and found that after successfully creating the DepthStencilView (DSV), I forgot to bind the DSVHandle to OMSetRenderTarget. After binding it, the occluded parts are no longer being rendered. Thank you, everyone, for your expertise. 🤣

    pD3D12CommandList->OMSetRenderTargets(1, &RTVHandle, false, &DSVHandle);

    pD3D12CommandList->ClearDepthStencilView(pDSVHeap->GetCPUDescriptorHandleForHeapStart(), D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr);

huangapple
  • 本文由 发表于 2023年6月13日 14:15:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76462116.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定