英文:
D3D12 Textured Cube faces being rendered incorrectly
问题
我目前正在使用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.
答案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);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论